serverless-next.js icon indicating copy to clipboard operation
serverless-next.js copied to clipboard

Next 13 - future plans - Is serverless-next.js dead?

Open anonymouscatcher opened this issue 2 years ago • 61 comments

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!

anonymouscatcher avatar Oct 26 '22 10:10 anonymouscatcher

@dphang @danielcondemarin

anonymouscatcher avatar Oct 26 '22 10:10 anonymouscatcher

I'd advise moving to another method of deployment.

mattbbc avatar Oct 26 '22 11:10 mattbbc

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

vafPER avatar Oct 26 '22 11:10 vafPER

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.

anonymouscatcher avatar Oct 26 '22 13:10 anonymouscatcher

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?

cmaerz avatar Oct 27 '22 07:10 cmaerz

seems to be dead 💀

gregkonush avatar Nov 02 '22 06:11 gregkonush

#2439 Doesn't seem that project goes forward. Any other approaches to deploy NextJS to AWS?

Docker on EC2.

mattbbc avatar Nov 02 '22 10:11 mattbbc

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

agnese-kerubina avatar Nov 03 '22 12:11 agnese-kerubina

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?

joyfulelement avatar Nov 13 '22 22:11 joyfulelement

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 avatar Nov 17 '22 11:11 fnavarrodev

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

kylekirkby avatar Nov 17 '22 11:11 kylekirkby

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 avatar Nov 17 '22 12:11 cmaerz

@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 avatar Nov 17 '22 14:11 fnavarrodev

@fnavarrodev We use Cloudflare. On all this services you can deploy your Origin on multiple Regions. So this shouldn't be a problem.

cmaerz avatar Nov 17 '22 14:11 cmaerz

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.

chrisFFL avatar Nov 18 '22 03:11 chrisFFL

https://aws.amazon.com/blogs/mobile/amplify-next-js-13/

arpecop avatar Nov 18 '22 23:11 arpecop

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.

uclaeamsavino avatar Nov 23 '22 19:11 uclaeamsavino

Just to note seems like serverless-components themselves are no longer directly supported by serverless :thinking: https://github.com/serverless/components

ryanolee avatar Nov 24 '22 14:11 ryanolee

https://aws.amazon.com/blogs/mobile/amplify-next-js-13/

Does not support ISR yet, even though they say it does.

TheManFromEarth1 avatar Dec 01 '22 09:12 TheManFromEarth1

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.

khuezy avatar Dec 05 '22 15:12 khuezy

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/

trompx avatar Dec 14 '22 10:12 trompx

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.

khuezy avatar Dec 14 '22 15:12 khuezy

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

arpecop avatar Dec 14 '22 16:12 arpecop

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.

fnavarrodev avatar Dec 15 '22 06:12 fnavarrodev

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.

khuezy avatar Jan 06 '23 18:01 khuezy

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.

didn't see V2 in NextjsSuite documentation. could u share a link?

suil avatar Jan 17 '23 18:01 suil

@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

khuezy avatar Jan 17 '23 18:01 khuezy

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?

suil avatar Jan 18 '23 05:01 suil

  1. create a new Next.js app npx create-next-app@latest
  2. go into the Next.js app and install npm install --save-dev sst@rc
  3. 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")
    });
  },
}
  1. run npx sst deploy

khuezy avatar Jan 18 '23 15:01 khuezy

  1. create a new Next.js app npx create-next-app@latest
  2. go into the Next.js app and install npm install --save-dev sst@rc
  3. 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")
    });
  },
}
  1. run npx sst deploy

Thx it worked really well

suil avatar Jan 19 '23 12:01 suil