feat: add `aws-lambda-edge` preset with CDK
🔗 Linked issue
- #79
❓ Type of change
- [ ] 📖 Documentation (updates to the documentation or readme)
- [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
- [ ] 👌 Enhancement (improving an existing functionality like performance)
- [x] ✨ New feature (a non-breaking change that adds functionality)
- [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
Add AWS Lambda@Edge to the preset.
The current aws-lambda preset is not compatible with the Lambda@Edge format and requires users to create their own wrapper for Lambda@Edge. This PR is needed to resolve this issue.
It would also be very powerful if Lambda@Edge were available in Nitro. It will be quite important for projects that require SSR (e.g Nuxt3) as static assets (.output/public) can be retrieved from AWS S3 and the rest (.output/server) can be resolved by Lambda@Edge.
Resolves #79
📝 Checklist
- [x] I have linked an issue or discussion.
- [x] I have updated the documentation accordingly.
I support this PR :)
(@WinterYukky You might consider a review request?)
@mirumirumi Thanks your comment!
Also, thank you @danielroe and @pi0 for reviewing🥰
Hi @WinterYukky Thanks for your works on this pull request and sorry review took long.
I will have to try the deployment and probably pushing some improvements to automate as much as possible for sdk use. (Hense self assigned).
Hi @pi0. I updated to automatically generate CDK code to the .output. Can you please re-review it?
@pi0 do we plan to release this change before nuxt stable release?
@danielroe do we plan to release this support before the stable release?
@anjali89r Yes, I will make sure I review it soon.
Codecov Report
Merging #240 (69049af) into main (e8fa771) will decrease coverage by
51.95%. Report is 6 commits behind head on main. The diff coverage isn/a.
:exclamation: Current head 69049af differs from pull request most recent head 08a5111. Consider uploading reports for the commit 08a5111 to get more accurate results
@@ Coverage Diff @@
## main #240 +/- ##
=========================================
- Coverage 51.94% 0 -51.95%
=========================================
Files 174 0 -174
Lines 12035 0 -12035
Branches 913 0 -913
=========================================
- Hits 6252 0 -6252
+ Misses 5686 0 -5686
+ Partials 97 0 -97
Thank you for your reviewing @danielroe! branch was out of date, so the latest changes were incorporated.
Also, as mentioned in https://github.com/unjs/nitro/pull/240#discussion_r907183618, I have created a small utility package for customers who want to customize their CDK projects. And I experimentally distribute it via NPM. It would be nice if this package could also be managed by unjs. How about it? https://github.com/WinterYukky/nitro-aws-cdk-lib
@danielroe any plan to support this preset soon ,? I believe there are lots of teams waiting for this PR to be merged to host nuxt ssr at the lambda edge
@pi0 anyway this PR can be also part of the 2.0 release?
Live Preview ready!
| Name | Edit | Preview | Latest Commit |
|---|---|---|---|
| nitro | Edit on Studio ↗︎ | View Live Preview | 3b2d3e718511309225e4090a4ce86c8c970eb139 |
Any news about this pr? This is quite important for AWS use cases, as stated here: https://github.com/unjs/nitro/discussions/1106
@danielroe @pi0 I've noticed that there's 2 PR open for aws-lamba-edge
- https://github.com/unjs/nitro/pull/240
- https://github.com/unjs/nitro/pull/1075
Which one should get merged ?
@danielroe @pi0 I've noticed that there's 2 PR open for aws-lamba-edge
Which one should get merged ?
the other one is newer, although it seems very similar to this one, while this one also has CDK and github action setup, which is very interesting!
Users deploying through IaC (SST/Terraform/Pulumi/Cloudformation) other than CDK and would find Cloudfront wrapper useful. It would require decoupling it from the CDK deployment.
Possible solutions could be to:
- Alter this pr to make CDK deployment optional and keep the Cloudfront handler wrapper.
- Create two presets (possibly extend one off the other):
- aws-lambda-edge
- aws-lambda-edge-cdk
Thanks for your reviewing @Hebilicious. I'm busy this week, so I'll fix this PR next week in line with your comments 😉.
@Hebilicious Thanks your reviewing!! I fixed lined by your comment. However I'm not understand your strategy about to merge two PRs. Should I merge to this PR from https://github.com/unjs/nitro/pull/1075?