Slingshot uploads to S3 fail on Galaxy

My app uploads files to Amazon S3 and it has worked great until I switched from Modulus to Galaxy. The uploads also work fine from my locally-running copy. Since the code is identical, I’m assuming it must have something to do with the bucket policy or CORS? Here’s what I have for those. Any ideas? Or any other ideas about the cause?

{
    "Version": "2008-10-17",
    "Id": "http better policy",
    "Statement": [
        {
            "Sid": "read and write policy",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": "arn:aws:s3:::gh-resource/*"
        }
    ]
}

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

…and here’s what the error looks like in the console.

I just now retrieved an error log from S3:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>494C0537FE12967A</RequestId>
<HostId>
x5d5uNEag7KlLM5cdhuzgfdrGPX+G/r1o6dm3vkTfEPQXR/K7odh5QzcEOpGufEFbzK5ouLIpFU=
</HostId>
</Error>

It’s most likely your not set up correctly, because I can reassure you that our application is on Galaxy and we use Slingshot to S3 just fine.

Did you follow the instructions here: https://github.com/CulturalMe/meteor-slingshot#aws-s3 ?

@Spyridon Yup. That’s where I got bucket policy and CORS and all the code to make it work. This feature has worked for about a year and half, both locally and on Modulus. I originally went with Modulus b/c I had these issues with Slingshot on Galaxy. But now I’m realizing that I probably did something to make it work on Modulus that I have to change for Galaxy. Working on it right now, as a matter of fact! Thanks for the reply.

1 Like

Fixed it! Here’s my lesson learned for any of you that see a 403 error when you try to upload to S3. 403 error means you are either supplying bad or empty or undefined access keys. Turned out it was easier to make my keys work with Meteor.settings on Modulus and now it’s easier to make them work as process.env variables on Galaxy.

1 Like