Deploy component without CloudFront
Is your feature request related to a problem? Please describe.
We currently use the serverless-nextjs-plugin project and want to swap over to the serverless-next.js component so that we can keep up to date with Next (now on v9.3).
We use a non-cloudfront version to create feature branches on pull request completion before then promoting to a cloudfront version with a known name (test, qa, prod, etc).
Describe the solution you'd like
We would like to be able to deploy to AWS without requiring a CloudFront environment to be built (20-25 mins per go).
Describe alternatives you've considered
Switching to Express and using Docker? 🤷🏻♂️
Hey @mattdell ! Welcome back 😄
In future I would definitely like to support API Gateway + AWS Lambda, especially now after the new HTTP API were released. This will probably result in a rewrite of serverless-nextjs-plugin.
However my focus right now is in upgrading to Serverless Components V2 using the Lambda@Edge Cloudfront architecture.
We use a non-cloudfront version to create feature branches on pull request completion before then promoting to a cloudfront version with a known name (test, qa, prod, etc).
Describe the solution you'd like
We would like to be able to deploy to AWS without requiring a CloudFront environment to be built (20-25 mins per go).
Deployments (aside from the first one) are super quick nowadays with Lambda@Edge. I consistently see my changes deployed in under 3 minutes. The changes will probably not be fully propagated but that's still pretty good. Is that not good enough for your use case? I do realise however the component doesn't wait for the CloudFront changes to propagate, so you'd need to check that yourself. A workaround this maybe is polling a version number in your app before running the tests and promoting?
For our use-case it would be beneficial to be able to deploy lambda-only and manually manage a CloudFront distribution. Our distribution also serves a blog and currently we use a Python script to deploy the website and then fix the origins and behaviors using boto3. This is something we probably could fix by configuring that stuff in serverless.yml but in the end that's functionality we don't want serverless-next.js to do. The best would be if it just wouldn't touch the CloudFront distribution during deployment.
For our use-case it would be beneficial to be able to deploy lambda-only and manually manage a CloudFront distribution. Our distribution also serves a blog and currently we use a Python script to deploy the website and then fix the origins and behaviors using boto3. This is something we probably could fix by configuring that stuff in
serverless.ymlbut in the end that's functionality we don't want serverless-next.js to do. The best would be if it just wouldn't touch the CloudFront distribution during deployment.
Have you taken a look at https://github.com/serverless-nextjs/serverless-next.js/tree/master/packages/lambda-at-edge ? It builds the .serverless_nextjs artefact with the code necessary in Lambda@Edge. It is completely agnostic from serverless.yml or serverless components.
Just to update, we are now using the component and it fits our use case. Deploys take between 2-5 minutes.
Just to update, we are now using the component and it fits our use case. Deploys take between 2-5 minutes.
@mattdell Hi! We would also like to reduce our deploy times from 20-25 minutes to your outcome of 2-5 minutes. What specific changes did you make?
Hard to say as we've since moved to hosted Vercel! 😅
This was 2 years ago so I can't remember much from it other than we moved from the plug-in to the component.
@mattdell When you refer to plug-in vs. component, I don't understand. Were these different versions of this project? Is there a release or tag number you could approximate?
Yep, this repo used to work as a Serverless plug-in instead of how it works now, as a Serverless component.
You can find the plug-in here in the deprecated folder: https://github.com/serverless-nextjs/serverless-next.js/tree/master/packages/deprecated/serverless-plugin
There is a thread here which might shed some light on it: https://github.com/serverless-nextjs/serverless-next.js/issues/664