# Deploy to S3

**URL:** <https://discourse.sst.dev/t/deploy-to-s3/134>\
**Category:** Chapter Comments\
**Created:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134 "2018-05-09T19:59:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/1 "2018-05-09T19:59:09Z")

</div>

_From @jayair on Mon Apr 10 2017 01:09:09 GMT+0000 (UTC)_  
  
Link to chapter - [http://serverless-stack.com/chapters/deploy-to-s3.html](http://serverless-stack.com/chapters/deploy-to-s3.html)  
  
_Copied from original issue: [https://github.com/AnomalyInnovations/serverless-stack-com/issues/63](https://github.com/AnomalyInnovations/serverless-stack-com/issues/63)_

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/2 "2018-05-09T19:59:10Z")

</div>

_From @riogaj89 on Wed Apr 26 2017 13:42:53 GMT+0000 (UTC)_  
  
When I run this command $ aws s3 sync build/ s3://gajen-notes-app-client, I get an error: Invalid endpoint: [https://s3.region=us-east-1.amazonaws.com](https://s3.region=us-east-1.amazonaws.com)… Any feedback on this?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/3 "2018-05-09T19:59:10Z")

</div>

_From @riogaj89 on Wed Apr 26 2017 15:29:50 GMT+0000 (UTC)_  
  
@jayair I was able to resolve the issue above, however, when I opened the webpage and tried to log in I get an error message TypeError: re is not a function. Am I missing anything?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/4 "2018-05-09T19:59:10Z")

</div>

_From @jayair on Wed Apr 26 2017 17:10:00 GMT+0000 (UTC)_  
  
@riogaj89 does the login on your local work fine?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/5 "2018-05-09T19:59:11Z")

</div>

_From @riogaj89 on Wed Apr 26 2017 18:18:58 GMT+0000 (UTC)_  
  
@jayair Yes it worked fine when deployed them on my local

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/6 "2018-05-09T19:59:11Z")

</div>

_From @jayair on Wed Apr 26 2017 23:23:32 GMT+0000 (UTC)_  
  
That’s really strange. Can I see the full error as it shows in the console?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/7 "2018-05-09T19:59:11Z")

</div>

_From @ryanjcruz on Sat May 20 2017 06:45:39 GMT+0000 (UTC)_  
  
@jayair just wondering, how secure is running this command? Would anyone - and I mean anyone be able to deploy to an S3 bucket if they know what’s the bucket’s name?

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/8 "2018-05-09T19:59:11Z")

</div>

_From @jayair on Sat May 20 2017 18:44:05 GMT+0000 (UTC)_  
  
@ryanjcruz In this case they need your AWS credentials to upload it. So as long as you are not giving those out, you should be fine.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/9 "2018-05-09T19:59:11Z")

</div>

_From @manubhat90 on Wed Aug 02 2017 21:26:12 GMT+0000 (UTC)_  
  
This guide is incredible, thanks for all the hard work!

I’m having an issue with the production build deployed to S3. Everything works fine locally and deployment isn’t an issue, but when I go to my S3 URL to load the application I get the following error in console:

Uncaught TypeError: Cannot read property ‘call’ of undefined  
at t (main.a20f4176.js:1)

Based on the the issue link below, I assume its something to do with webpack. Any chance you have an idea of how to fix it? Haven’t been able to figure it out myself.

> <https://github.com/webpack/webpack/issues/959>

I’ve incorporated a couple additional things to your guide: redux, react-redux, react-router-redux, redux-thunk, redux form and some babel/eslint stuff. Link to my test repository below, would really appreciate any help or thoughts.  
[https://github.com/manubhat90/serverless-test](https://github.com/manubhat90/serverless-test)

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/10 "2018-05-09T19:59:12Z")

</div>

_From @biznuge on Tue Aug 22 2017 08:32:21 GMT+0000 (UTC)_  
  
Once I attempted the **_aws s3 sync_** command here, I realised nothing was being written to my s3 bucket.

After a little reading I realied that my admin IAM user didn’t have PUT access to that bucket, so I amended the bucket policy to the version I’ve provided below.

```auto
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadForGetBucketObjects",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::notes-app-client-XXX/*"
        },
        {
            "Sid": "PublicWriteForPutBucketObjects",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::YYYYYYYY:user/admin"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::notes-app-client-XXX/*"
        }
    ]
}

```

Hopefully this helps someone out in the same situation.

Otherwise an absolutely smashing tutorial here guys. Amazingly thorough and I’ve learned loads in just a few short hours.

Cheers.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/11 "2018-05-09T19:59:12Z")

</div>

_From @jayair on Tue Aug 22 2017 17:14:16 GMT+0000 (UTC)_  
  
@biznuge Thanks for the kind words!

And thanks for reporting back. I’m sure it’ll help some folks.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/12 "2018-05-09T19:59:12Z")

</div>

_From @designpressure on Mon Sep 25 2017 08:04:00 GMT+0000 (UTC)_  
  
when trying to sync I received this message

```auto
fatal error: Could not connect to the endpoint URL: "https://s3.Frankfurt.amazon
aws.com/notes-app-client-my1test?prefix=&encoding-type=url"

```

a couple of thing I don’t understand:

- what is this `?prefix=&encoding-type=url`
- why `s3.Frankfurt.amazon` while up to now all regions where in the form `eu-central-1`?  
As a matter of fact I don’t know where to start troubleshooting… if someone can help…

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/13 "2018-05-09T19:59:13Z")

</div>

_From @designpressure on Mon Sep 25 2017 08:24:55 GMT+0000 (UTC)_  
  
Ok, so maybe this can help somebody else. I created the notes-app-client folder inside the notes-app-server. I thought it should inherit the login credential but it didnt, so I simply reconfigure awscli with a new accesskey and secretId.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/14 "2018-05-09T19:59:13Z")

</div>

_From @QuantumInformation on Fri Oct 06 2017 15:29:23 GMT+0000 (UTC)_  
  
Don’t forget to use `--profile personal` when uploading if you have profiles otherwise you will get

```auto
serverless-stack-demo-client git:(master) ✗ aws s3 sync build/ s3://notes-site-test           
fatal error: An error occurred (InvalidRequest) when calling the ListObjects operation: You are attempting to operate on a bucket in a region that requires Signature Version 4. You can fix this issue by explicitly providing the correct region location using the --region argument, the AWS_DEFAULT_REGION environment variable, or the region variable in the AWS CLI configuration file. You can get the bucket's location by running "aws s3api get-bucket-location --bucket BUCKET".

```

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/15 "2018-05-09T19:59:13Z")

</div>

_From @teseodemigod on Sat Dec 02 2017 19:13:37 GMT+0000 (UTC)_  
  
Hi all, everything was working fine until I run npm run build… I’m using babili instead of uglify… The build is complete, but when I run the project I get this error: **_Uncaught (in promise) TypeError: h.a.config.credentials.getPromise is not a function_**

The line is **_return AWS.config.credentials.getPromise()_** in the _**getAwsCredentials()**_ method, file _ **awsLib.js** _

Does anybody have an idea of what’s going wrong?  
Thanks in advance for helping.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/16 "2018-05-09T19:59:13Z")

</div>

_From @jayair on Sat Dec 02 2017 19:24:22 GMT+0000 (UTC)_  
  
@teseodemigod I’m not too familiar with your setup so I can’t really help. But maybe somebody else can.

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/17 "2018-05-09T19:59:14Z")

</div>

_From @roxy-target on Mon Dec 11 2017 14:35:42 GMT+0000 (UTC)_  
  
Hi,

I created my S3 bucket and went to do npm run build and I deployed the build/ file to the S3 bucket I created.  
In AWS the bucket shows up with all the files created in the build file, however when I go to the endpoint, the url where my app should be live, it shows up with the favicon icon but the screen is blank and the error i get from the console is:  
Failed to load resource: the server responded with a status of 404 (Not Found)  
main.f5cd3d98.js Failed to load resource: the server responded with a status of 404 (Not Found)  
main.0e9b8740.css Failed to load resource: the server responded with a status of 404 (Not Found)  
I understand that it is not reading the static files created during the build but I cannot seem to figure out how to fix this error?  
Hopefully someone can help me please? Thanks 🙂

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/18 "2018-05-09T19:59:14Z")

</div>

_From @jayair on Tue Dec 12 2017 17:49:24 GMT+0000 (UTC)_  
  
@roxy-target Can you ensure the permissions for the S3 bucket are set right? The CORS and permission section in this chapter - [https://serverless-stack.com/chapters/create-an-s3-bucket-for-file-uploads.html](https://serverless-stack.com/chapters/create-an-s3-bucket-for-file-uploads.html)

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/19 "2018-05-09T19:59:14Z")

</div>

_From @roxy-target on Wed Dec 13 2017 15:04:22 GMT+0000 (UTC)_  
  
@jayair I manage to get it working ! So thank you for the help 🙂

---

<div class="post-metadata">

**Author:** ![anomalyinnovations](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.sst.dev/anomalyinnovations/32/10_2.png) [@anomalyinnovations](https://discourse.sst.dev/u/anomalyinnovations)\
**Post date:** [May 9, 2018, 7:59pm UTC](https://discourse.sst.dev/t/deploy-to-s3/134/20 "2018-05-09T19:59:14Z")

</div>

_From @jonasbarsten on Sat Jan 20 2018 18:10:54 GMT+0000 (UTC)_  
  
Should maybe add --delete to

`aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete`

So that the changes don’t accumulate.

Before I did that, earlier versions were buffered and the correct version was not always rendered.

[Next page](https://discourse.sst.dev/t/deploy-to-s3/134.md?page=2)
