Amplify + Nextjs 12: CloudFront error 503 on API routes

0

I've deployed a Nextjs v12 app on Amplify but I got error 503 on nextjs API routes:

ISSUE The Lambda function associated with the Cloudfront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. If you provide content to customers through Cloudfront, you can find steps to troubleshoot and help prevent this error by reviewing the Cloudfront documentation.

MY TRIES I tried to add permissions for lambda functions to the Amplify role but it doesn't work. Also can't find a policy specific to lambda@edge. I can see on the linked Cloufront the lambda@edge. I found different documentation on this issue but the only solution proposed was to downgrade Nextjs to v11, something I wan to avoid. No issues logged in the Amplify deploy: 2023-03-21T18:42:58 [INFO]: Deployed the following resources to your account: 2023-03-21T18:42:58 [INFO]: - CloudFront Domain ID: xxx 2023-03-21T18:42:58 [INFO]: - SSR Lambda@Edge: xxx 2023-03-21T18:42:58 [INFO]: - API Lambda@Edge: xxx 2023-03-21T18:42:58 [INFO]: - Image Optimization Lambda@Edge: xxx 2023-03-21T18:42:58 [INFO]: - S3 Bucket: xxx 2023-03-21T18:42:59 [INFO]: Deployment complete

SPECS I'm using Amplify 'web dynamic', Nextjs v12, prisma (I do 'npx prisma generate' in the build phase).

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions