Reputation: 43
I have tried to use Nextjs getStaticProps function on a page
and deployed it on AWS Amplify. However when I gave the option 'revalidate'
AWS cloudfront occurred an error. A 503 error saying it didn't have permission
something like that... does anyone know how to fix this problem?
Upvotes: 3
Views: 2021
Reputation: 357
Increasing the "revalidate" from 60 to 600 did the trick for me.
Upvotes: 0
Reputation: 5778
First, go in Cloudwatch logs in the region where the error occurred, with Log Insights, find the error. You will get more details about the reason Lambda raised a 503.
I bet it's SQS rights. As quoted here: https://github.com/aws-amplify/amplify-hosting/issues/2175#issuecomment-900514998
Fixable like this:
TL;DR: Add SQS rights to your lambda function execution role.
1/ With your log error, you will get the lambda function name
2/ Go to the lambda function configuration, and get Role name, then click to edit
3/ Edit the permission policiy in JSON and add this:
{
"Action": [
"sqs:*"
],
"Resource": [
"arn:aws:sqs:us-east-1:*:*"
],
"Effect": "Allow"
}
Review and apply, it should work.
Upvotes: 6