Lambda deployments for Nextjs12 & Nextjs13 (standalone). Easy CLI commands to get your standalone Next output to run in AWS Lambda (not @Edge)! Uses CDK in behind and produces code zips importable to Terraform, Serverless, Azure, etc.
MIT License
169
stars
19
forks
source link
Adds customization options for API domain and image lambda #67
Hi! Thanks for this great tool, it's helping me a lot. Here's my first contribution, I hope you like it.
Proposed changes
Customization of image lambda memory and timeout parameters
My team is currently working on a website in which the users upload very large images, and the image handler is having a hard time optimizing them with the default settings. I've found the perfect settings for my case (60s timeout and 1Gb memory), but I'm pretty sure this should not be the default. Hence my contribution, to allow their customization (both by CLI and the new CdkUtils class).
To avoid repeating the defaults over and over, I've established some constants on the imageLambda.ts file with the default values. Let me know if this is OK.
Customization of the API domain
While the Next.js rewrite support works nicely, it increases the total cost of the deployment since the server API will be charged while the real backend does its work. This gets worse when the backend is also deployed as a lambda function on the same account, as they will consume two concurrent execution quotas.
The new option should allow full customization of the /api origin when using the CdkUtils class, but can also create a simple HttpOrigin with an specified domain using the CLI.
Notes
I've noticed there's a .prettierrc, but most files are not respecting the configured formatting. I tried to minimize the diff, so I reverted any big changes prettier introduced. Let me know if that's ok.
I haven't updated the package version or the CHANGELOG.md, should I?
Changes makes total sense and implementation is flawless to what I would do myself.
To address your notes:
yeah, I'm gonna need to improve the contribution guide as well as eslint/prettier config a bit, my focus was on features and it "worked on my localhost" 😬
version bump and CHANGELOG will get updated once merged into master :) no need to worry about that
Hi! Thanks for this great tool, it's helping me a lot. Here's my first contribution, I hope you like it.
Proposed changes
Customization of image lambda memory and timeout parameters
My team is currently working on a website in which the users upload very large images, and the image handler is having a hard time optimizing them with the default settings. I've found the perfect settings for my case (60s timeout and 1Gb memory), but I'm pretty sure this should not be the default. Hence my contribution, to allow their customization (both by CLI and the new
CdkUtils
class).To avoid repeating the defaults over and over, I've established some constants on the
imageLambda.ts
file with the default values. Let me know if this is OK.Customization of the API domain
While the Next.js rewrite support works nicely, it increases the total cost of the deployment since the server API will be charged while the real backend does its work. This gets worse when the backend is also deployed as a lambda function on the same account, as they will consume two concurrent execution quotas.
The new option should allow full customization of the
/api
origin when using theCdkUtils
class, but can also create a simpleHttpOrigin
with an specified domain using the CLI.Notes
.prettierrc
, but most files are not respecting the configured formatting. I tried to minimize the diff, so I reverted any big changes prettier introduced. Let me know if that's ok.CHANGELOG.md
, should I?