Deploy to S3

Yes, the number is different between the two reloads. So, at first, my prod deploy had main.b7254569.js in the Sources view in the console. The HTML was also referencing main.b7254569.js. Then I deployed prod and refreshed the page. At this point, the page was blank. The main.{hash}.js file wasn’t even in the Sources view in the console, and it was throwing an error in the old main.b7254569.js file, which shouldn’t be there anymore. The error said “Uncaught SyntaxError: Unexpected token <”. It’s worth noting at this point, my index.html was referencing the new main.7fd9f660.js file that was missing from the Sources. Then, I refreshed again and I saw the new main.7fd9f660.js file in the Sources and my page content actually loaded.

I’m interested in a version of the React client that uses redux and thunk. However your repo is currently unavailable, do you happen to have moved it somewhere else?

If not, can any kind soul provide a redux/thunk version of the React client that this tutorial uses?

Yeah definitely seems like a caching issue. It could be related to PWAs. Can you try this and give it a try.

Hmm our repo is always where it has been. It is right here https://github.com/AnomalyInnovations/serverless-stack-demo-client.

Thank you! That seems to have done the trick. I deployed with that unregister() code yesterday and then I did another deploy today to test it. Refresh worked just fine in my Chrome browser on both desktop and mobile. Thanks again

1 Like

Awesome. Yeah they are going to disable this by default in the new Create React App. It causes too many unintended consequences.

AWS may have updated their default bucket configs, I needed to uncheck both Manage public bucket policies in the Public access settings tab of my bucket before I could access it from its static URL.

2 Likes

Got it. Thanks for letting us know.

I got a similar issue. I had to uncheck both options and when I hadnt I received a 403 error when trying to view the public website.

I see. Yeah we’ll update it soon.

Hi everyone,

I have an issue after upload image to s3. It show popup “TypeError: Cannot read property ‘length’ of undefined”
Also data didn’t store in DynamoDb and it was only image store in S3.

Can you debug to see where that error message is coming from?

First, great tutorial, extremely helpful!

I’m having the same issue and don’t know how where to go from here. When I try to sync my build with S3 (aws s3 sync build/ s3://notes-app-client-recprotocol) I get the same error (fatal error: Could not connect to the endpoint URL: “https://notes-app-client-recprotocol.s3.eu-east-1.amazonaws.com/?list-type=2&prefix=&encoding-type=url).
Any help would be greatly appreciated. Thanks in advance!!!

1 Like

Hmm that’s really weird. Can you check your S3 bucket settings and make sure that bucket is configured properly? You can try simple uploading directly through the console to see if that works.

With that method, the app is still publicly accessible through HTTP, isn’t that not secure? (E.g. http://notes-app-client.s3-website-us-east-1.amazonaws.com/ is still accessible)

Yeah I think somebody else had brought this up. I’m not sure what the solution here is. But in practice I’m this shouldn’t be as much of an issue. You could for example, set the CORS permissions to disallow API calls from your S3 bucket hosted app.

Edit: However, if you find a solution to force or disable the bucket hosted version, let me know.

Hey Guys, fantastic guide by the way.
I think I have all of this working beautifully (locally anyway), uploaded to s3 just fine etc

Strangely however when I connect or browse to index.html I am getting a ‘Sorry, Page not found.’
The login and signup pages work fine as does the Notes page once authenticated

Is this a potential routing issue for an unauthenticated user or something. Same happens in incognito or when trying safari (instead of chrome)

Any ideas of where to look would be appreciated!!

Thanks again for this fantastic walk through Ive really enjoyed following it!!

What does the error look like? Is it one that we are generating in our app?

“Sorry, page not found” so it’s a generated page … Only if trying to directly access “index.html” which we never setup in the routing… however since I setup the full domain hosting it seems to function without error and regardless of logged in or out… So no problem for now?

I guess this makes sense. If you navigate to pretty much any route that isn’t supported, you should get this error. So it is expected right?