Reputation: 1882
I just deployed my web app built in Next.js onto AWS and weird thing happens:
All normal routes (e.g. xxx.com/pagename) work perfectly and the pages are accessible as normal.
All dynamic routes (e.g. xxx.com/pagename/:itemId) are not working and throw 502 errors.
I am sure that those pages do exist since I can access them without a problem when I run next start
locally.
The app is accessed via Route 53 => CloudFront => ELB => EC2.
Has anyone encountered a similar case like this? How should I solve this issue?
PS. Next.js dynamic routes don't work properly when deployed I have read this and the content checker inside the page has already been applied. Also, the server didn't receive anything when the page throws the error. I believe it is a frontend or configuration issue.
Upvotes: 1
Views: 688
Reputation: 1882
https://github.com/vercel/next.js/issues/15981
I found this issue and tried to remove the function getServerSideProps
from my app. And now it works without an issue.
Luckily I have nothing that must be loaded in server-side rendering in my current project. Still wondering why it does not work on AWS.
Would leave this question open to see if there's any better solution for this.
Upvotes: 0