- Newest
- Most votes
- Most comments
The 403 error you're experiencing with your AWS Amplify hosted Next.js application could be due to several potential causes, especially since it occurred suddenly without any changes to your deployment.
Based on the information provided, here are some possible causes and solutions:
-
Intermittent CloudFront Issues: The 403 error from CloudFront can occur randomly or intermittently. This is a known issue with Amplify applications where requests might fail with a 403 error but work fine on refresh. Since your background jobs are failing in the middle of processing, this could be related to this intermittent behavior.
-
AWS WAF Rules: Even though you mentioned the WAF was not enabled initially when the issue started, there might be default AWS WAF rules or configurations that are blocking your background job requests. When CloudFront sits behind AWS WAF, it can be difficult to distinguish between a 403 from your origin and a 403 from AWS WAF blocking a request.
-
Authorization Headers: If your background jobs require authorization headers for API requests, there might be an intermittent issue with these headers not being properly attached to requests, causing 403 Forbidden errors. This is a known issue with AWS Amplify where authorization headers are occasionally missing from API requests.
-
CloudFront Configuration: There might have been changes to the underlying CloudFront distribution that Amplify manages on your behalf, even if you didn't make any changes to your application.
Here are some troubleshooting steps you can take:
-
Check CloudFront logs and AWS WAF logs (if enabled) to see if there are any patterns to the 403 errors.
-
Implement more detailed error logging in your application to capture information about the failed requests.
-
Try invalidating the CloudFront cache for your application.
-
If your background jobs use authentication, verify that tokens are being properly managed and refreshed.
-
Contact AWS Support as they can provide more detailed information about any changes or issues with the underlying CloudFront distribution that Amplify manages.
Since this issue started suddenly without any changes on your part, it's possible that there was an update or change on AWS's side that is affecting your application's behavior with external services like Upstash.
Sources
Amplify 403 Error | AWS re:Post
Intermittent Authorization Header Issue with AWS Amplify | AWS re:Post
Firewall support for AWS Amplify hosted sites | AWS News Blog
HTTP 403 status code (Permission Denied) - Amazon CloudFront
Hello, based on AWS documentation - https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-403-permission-denied.html - there could be a number of reasons for 403 errors.
In your CloudFront distribution, do you have geographic restrictions - blocking the application can from certain regions. It's possible Upstash is interacting with your application from different region - maybe they alter at a time interval or there is a maintenance window and your CloudFront configuration is blocking this alternate location.
Relevant content
asked 9 months ago
asked 4 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 5 years ago

Hi @SHAJAM ... there are no geographic restriction applied, and, even with WAF disabled I am getting the same error. And to confirm, WAF was not enabled in Amplify when i first started experiencing this issue on Friday.