user17561857
user17561857

Reputation:

Cloudfront 404 page not loading js

I have a Gatsby React site in an S3 bucket hosted through CloudFront.

Using error configurations in CDK, my site will load the correct 404 page when an error occurs.

However, the js on the 404 page will not load and this error is displayed in the console.

Uncaught (in promise) Error: page resources for /nonexistentpage/ not found. Not rendering React at ...

Cloudfront config

responseCode: 200,
errorCachingMinTtl: 604800,
errorCode: 404,
responsePagePath: "/error.html"

This works locally so I assume it is a cloudfront issue.

Upvotes: 0

Views: 476

Answers (1)

user17561857
user17561857

Reputation:

If anyone else is struggling with this, changing responseCode to 404 fixed this problem

Upvotes: 0

Related Questions