Decouple lambda-at-edge deploy logic from nextjs-component
See original GitHub issueCurrently, the Lambda@Edge deploy logic is actually coupled into nextjs-component
.
As a first step to making this package more generic and extensible for supporting other serverless platforms (e.g Lambda, Cloudflare), all Lambda@Edge logic should live in the lambda-at-edge
package. It would be a plugin and implement two features:
- Build (already done): builds artifacts for deploying to Lambda@Edge. Ex: default-handler, api-handler, assets (building of assets for S3 was recently decoupled from component to lambda-at-edge).
- Deploy: we need to move all deployment logic currently from
nextjs-component
intolambda-at-edge
. Currently, it’s doing all the CloudFront, S3 and Lambda deployment work, but this should really live inlambda-at-edge
. Of course, if there’s shared logic (e.g S3 upload logic may be same for Lambda vs. Lambda@Edge), then we’ll put those in the respective internal packages.
As part of this, we can define a standard interface that all plugins should implement.
Afterwards, nextjs-component
itself will be very lightweight and simply call the plugin to use based on inputs (e.g lambda-at-edge for now, and others later).
I also suggest to rename lambda-at-edge
to lambda-at-edge-plugin
to be clearer later on.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Deploying Next.js to AWS using Serverless Next.js
Learn how to deploy a Next.js application to AWS Lambda in Serverless Mode using the Serverless Next.js Component.
Read more >Serverless Next.js Component - Morioh
It is the component's job to deploy your application ensuring parity with all of next's features we know and love. We try to...
Read more >Serverless Next.js Component - Serverless Framework: Plugins
We try to emulate all or most of the routing and server-side logic from Next.js and optimize it for a serverless environment. Below...
Read more >Testing a new CDK Construct to deploy a Serverless NextJS ...
One tremendous gap, specially for me, was a good way to deploy React apps on AWS ... Source: Serverless Next.js Component GitHub repository....
Read more >Deploy logic app templates - Azure - Microsoft Learn
Deploy Azure Resource Manager templates for Azure Logic Apps · In this article · Deploy through Azure portal · Deploy with Visual Studio...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We could possibly remove the need for Serverless whilst still supporting serverless components via https://github.com/serverless-components/aws-cloudformation 🤩 Tempting.
Thanks for the thought out reply, overall sounds very sensible to me 🙂
This would be quite nice 💯
The proposal to introduce a new platform sounds really good as well. Possibly an easy first candidate would be Lambda + API Gateway.
I used CDK as an example. I was trying to convey it would be nice if we supported other deployment / IaC frameworks such as CDK or Terraform.
There is an interesting trade-off to consider here. Whilst it makes it easier for us to maintain, it means enforcing a particular way of deploying to users. For example, some people will use CDK, others Terraform etc. Ideally
serverless-next.js
would provide different entry points for each. That way it integrates nicely with existing tools folks already use for their IaC projects.CDK for Terraform sounds quite interesting and potentially a really good fit for this project. 👍