-
-
Notifications
You must be signed in to change notification settings - Fork 463
Could you still support deploy nextjs 9 using lambda not lambda edge? #296
Comments
Too bad I'd stay with I hope @danielcondemarin add support for Next9 |
I am considering adding support for AWS CDK as an alternative to folks that don't use the Serverless Framework or Components. However, I'd like to keep the architecture the same using Lambda@Edge etc. |
@danielcondemarin One reason not to use Lambda@Edge is the lack of environment variables |
Adding to that ^^^ not everyone need Lambda@Edge, or serverless components (while it helps with dev spinning stuff up quickly, also mean we have to change our architecture to accommodate for components). |
I definitely agree that at least providing an alternative to Serverless Components (even if it sticks with Lambda@Edge, which is probably a good idea anyway), mainly due to the lack of maturity of Serverless Components at this stage. For example, the lack of remote state storage makes it somewhat painful to setup in a CI/CD pipeline. |
In our case we use different CDN so CloudFront is not an option right now. We need to deploy nextjs v9 as a regular lambda, not @edge |
I'm using the next-aws-lambda in order to render next.js pages inside a normal lambda, since I don't either want to use Lambda@Edge (or serverless-components). You will have to patch the event to adapt it to your lambda, but you can use the default-lambda-handler as a starting point. Maybe a separate package/feature for an existing one that provides compatibility layers for @edge events, APIGateway or ALB events may help covering different use cases? |
That was the idea behind creating a separate package for the API GW -> Lambda compat layer on the first place. I still need to do the same for CF Edge. Basically would be pulling |
Would be nice to be able to use the packages even if you are not using serverless-components, so the people like me that just need some pieces can benefit of the building blocks you create. |
I've now decoupled most of the responsibility to deploy to Lambda@Edge from the serverless component. There is now a separate package for creating the Lambda@Edge handlers plus a bunch of other things -> https://github.com/danielcondemarin/serverless-next.js/tree/master/packages/lambda-at-edge |
+1, because Lambda@Edge has disadvantage:
|
Another reason not to use Lambda@Edge is that you cannot connect to things inside your VPC. @danielcondemarin Could you explain what needs to change for someone who might want to submit a PR? I would definitely take a weekend to do this if I had the basic blueprint for what you'd want. If I understand correctly, we would need to use the API Gateway for normal lambdas so when you say |
Yes, Lambda makes sense as the next platform to support. @danielcondemarin and I had some brief chats about making this component. more platform-agnostic. Though I think we still need to genericize the code a little more to support any platform (not just Lambda or Lambda@Edge) in general as the core routing logic is tied to Lambda@Edge. We really should be doing this way to make this component the most maintainable, generic and flexible:
Right now I am trying to decouple build & deploy steps (have a PR out to generate assets as part of build) which is kind of loosely-related work. Next I will try to separate out core serverless Next.js logic from Lambda@Edge handler itself, so we can have the core logic that any platform plugin can use to build its own handler. Then after we should be able to more easily build Lambda support. @emhagman I think if you want to, you can help create the lambda plugin (or at least the build + deploy steps). Maybe create a new package @sls-next/lambda-plugin which will do build & deploy. Ex, you can assume the core logic will be extracted from Lambda@Edge package (I can help work on that as part of general work on this). I would think it would go something like this:
Though we did not finalize the interface for plugins, you can probably add some initial code to do build/deploy work and we can refactor it a bit once finalized. If you want to help with Lambda support, you can probably ask @danielcondemarin for an invite to our channel to discuss more. We are re-thinking infrastructure management so maybe we can try to deploy Lambda using CDK for Terraform (depends on finalization) |
A little time has passed so curious how this has evolved? Any help needed? We're running into the problem as well that we can't connect to our VPC and access internal services. |
Hey! Looking into it as well. Any updates or plans? PS. I don't mind support for later versions of Next only. |
for some technology constrains, we still want to use lambda to render the nextjs apps, but not lambda edge, but the plugin move complete to component way to deploy nextjs 9 and only apply to lambda edge, is there a way we can deploy the app like nextjs8 by using plugin and we can employ the frontend library nextjs 9?
The text was updated successfully, but these errors were encountered: