serverless-next.js
serverless-next.js copied to clipboard
Next 13 - future plans - Is serverless-next.js dead?
I just wanted to open this issue as a feature request. This project appears to be dead, and I need to migrate my current application to something new that is active and supports new NEXT JS features such as middleware, possibly Vercel! But I'd really like to know the status of this project. I know that the maintainers are very busy and don't have time to work on this project. Any plans for the future? Also, it would be nice to let us know If anyone has already migrated to something else, share your thoughts!
@dphang @danielcondemarin
I'd advise moving to another method of deployment.
We have the same problem here. Our Back-end is based on AWS serverless (C#) and our Front-end is based on Next and deployed on AWS too . We are eager to cooperate and teamwork for migration of our front-end with Anyone or any team who has the same problem so we can achieve a better result together and troubleshoot together along the way
BANG, you cannot even deploy with next13 because of some errors that target is not supported anymore and invalid root options in next.config.js
Error: The "target" property is no longer supported in next.config.js.
https://github.com/serverless-nextjs/serverless-next.js/discussions/2439 Doesn't seem that project goes forward. Any other approaches to deploy NextJS to AWS?
seems to be dead 💀
#2439 Doesn't seem that project goes forward. Any other approaches to deploy NextJS to AWS?
Docker on EC2.
Dead is a strong statement. IMO It still is a very solid way to deploy v11/10 next.js , that is compatible up to current next version (have not checked recent v13, but it came out like couple of days ago), minus deployment sensitive features. You lose on some features, but you get self managed serverless way to deploy next app. I for one manage a project where these pros still outweigh the cons and the architecture provided here is perfect for my project - I am ready to embrace its quirks, so to speak.
If you need any of the deployment sensitive features from next, you can still add them here (provided they are compatible with architecture offered here), maintainer has been very open to contributions.
Thing is, Vercel is doing amazing work and only way to be truly up to speed with all they do is to either use architecture they provide or just do a server deployment (That is an easy backup plan if things truly go weird the js way).
Next.js v13 have introduced React (v18) Server Components, and making it default for app/
directory. As it switches towards more emphases on SSR, I am too wonder how Next.js v13 app can be deployed to AWS while meeting the server runtime requirement? (Perhpas the generally assumption is lambda@edge with AWS CloudFront will continue support such runtime requirement for Next.js v13?) Would AWS Amplify eventually support it?
Next.js 13, Does it work on other platforms a part from Vercel? Maybe Netlify? Having it in running as a server on an EC2 is not the best scenario.
@fnavarrodev this is the problem when falling into the open-source trap.
Next.js - A great open-source project that heavily relies on a commercial product to actually use most of the features...
You can easily deploy Next.js with a Docker Container to AWS Apprunner, AWS ECS / Fargate or Google Cloud Run.
For AWS just try: https://aws.github.io/copilot-cli/ https://github.com/vercel/next.js/tree/canary/examples/with-docker
You need a shared storage if you want to use ISR: https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration#self-hosting-isr
@cmaerz as far as I know those technologies are on not on the edge, but I could be wrong. I supose you can use cloudfront with a proper cache policy to minigate the latency to your AWS region
@fnavarrodev We use Cloudflare. On all this services you can deploy your Origin on multiple Regions. So this shouldn't be a problem.
For those looking for a simple fix, I can confirm decrementing next
and eslint-config-next
to 12.x
fixed this error for me.
Obviously there are tradeoffs to downgrading, but I was able to get this package to deploy my build as expected afterward.
https://aws.amazon.com/blogs/mobile/amplify-next-js-13/
https://aws.amazon.com/blogs/mobile/amplify-next-js-13/
I just came here to post that. We've been playing around with it and it looks promising.
Today, AWS Amplify Hosting announces Next.js 12 and 13 support. Your app can take advantage of Next.js features including server-side rendering (SSR), API routes, middleware, incremental static regeneration (ISR), and image optimization.
In combination with Next.js feature support, Amplify Hosting is improving the experience of running Next.js apps on AWS:
Faster builds. Next.js apps deploy at least 3x faster, helping developers deliver changes to production faster. Amazon CloudWatch integration. Server-side logs are delivered to Amazon CloudWatch, allowing teams to observe, monitor and troubleshoot their apps. Next.js apps work seamlessly with Amplify back-ends such as Authentication and Data. Fully managed hosting infrastructure reduces operational overhead for development teams, with fewer resources to manage in your AWS account. To learn more about pricing visit https://aws.amazon.com/amplify/pricing/. Follow the tutorial below to create and deploy your Next.js app to AWS with Amplify Hosting.
Just to note seems like serverless-components themselves are no longer directly supported by serverless :thinking: https://github.com/serverless/components
https://aws.amazon.com/blogs/mobile/amplify-next-js-13/
Does not support ISR yet, even though they say it does.
Hi, if anyone else is interested in deploying on AWS (a lot more flexible/cost-effective than Vercel), consider using SST. The SST team is implementing its own version that's up to date w/ the latest NextJS version. You can find them on discord https://discord.com/invite/sst in the nextjs channel. Drop on by and asks questions. As of now, most nextjs features are supported/in development.
Hi, if anyone else is interested in deploying on AWS (a lot more flexible/cost-effective than Vercel), consider using SST. The SST team is implementing its own version that's up to date w/ the latest NextJS version. You can find them on discord https://discord.com/invite/sst in the nextjs channel. Drop on by and asks questions. As of now, most nextjs features are supported/in development.
A few links to:
-
Their first project: https://sst.dev/examples/how-to-create-a-nextjs-app-with-serverless.html
-
Their new project recently annouced: https://github.com/serverless-stack/open-next https://open-next.js.org/
To add to those resources, if you'd like to get something up and running now, you can use this Construct: https://github.com/jetbridge/cdk-nextjs. cdk-nextjs-standalone
will incorporate open-next
once open-next
is stable. The official SST Open-Nextjs Construct may or may not use cdk-nextjs-standalone
, but it should be an easy replacement.
Amplify build takes few minutes , I even optimised it shorter ... don't like the fact they provide expensive machine for the build process , you can always ship the .next directory pre-built
With Amplify and nx-cloud the build is quiet fast, I think now is faster that it was before with next.js 12 and serverless, but still slow compare with Vercel.
Update: SST
v2 NextjsSite
construct has integrated w/ open-next
. There's still a few things to iron out like middleware
redirection and viewer request vs origin request
policy.
But for the most part, it works great.
Update:
SST
v2NextjsSite
construct has integrated w/open-next
. There's still a few things to iron out likemiddleware
redirection andviewer request vs origin request
policy.But for the most part, it works great.
didn't see V2 in NextjsSuite documentation. could u share a link?
@suil The doc for v2 isn't ready yet, but you can reference it on the sst2
branch: https://github.com/serverless-stack/sst/tree/sst2/packages/sst/src/constructs
example: https://github.com/serverless-stack/sst/tree/sst2/examples/nextjs-app
so you mean still use `npx create-sst@latest my-project' to create a ss1 project. but import { NextjsSuite } from https://github.com/serverless-stack/sst/tree/sst2/packages/sst/src/constructs
right?
- create a new Next.js app npx create-next-app@latest
- go into the Next.js app and install npm install --save-dev sst@rc
- add an sst.config.js
import { NextjsSite } from "sst/constructs"
export default {
config: () => ({
name: "my-app",
region: "us-east-1",
}),
stacks: async (app) => {
app.stack(function Web(ctx) {
new NextjsSite(ctx.stack, "MySite")
});
},
}
- run npx sst deploy
- create a new Next.js app npx create-next-app@latest
- go into the Next.js app and install npm install --save-dev sst@rc
- add an sst.config.js
import { NextjsSite } from "sst/constructs" export default { config: () => ({ name: "my-app", region: "us-east-1", }), stacks: async (app) => { app.stack(function Web(ctx) { new NextjsSite(ctx.stack, "MySite") }); }, }
- run npx sst deploy
Thx it worked really well