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).

沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南