Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because of how Next.JS builds, you can't just deploy it as-is to something like AWS Amplify or Elastic Beanstalk. For example, if you attempt to deploy to Amplify, you'll get a bunch of 503 errors on SSR pages because of Cloudfront permissions. The static pages work fine though. I'm not exactly sure as to why you can't just "npm run start" on a Next.js app on a deployment service like ELB or Amplify. Perhaps because of the extra SWC compiler Next uses for builds?

I believe Docker works because you're doing "npm run start" and containerizing Next.js, essentially proxying the server to then serve to the client. Basically running it on localhost. For example, you can run Next.js on EC2 if you want, but you have to proxy the connection to allow the client to connect to it.

Again, I'm not an expert as to why exactly it doesn't work - I just know that it doesn't work the same way a simple node app works, which therefore adds a ton of steps involved that don't make it worth it to me.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: