sladg / nextjs-lambda

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Figure out passing of env vars into CDK when used as CLI

sladg opened this issue · comments

commented

I want to be able to pass environment variables during deployment, at the same time, I don't want to manage CDK myself as that's unnecessary overhead.

We need a convention on how to pass env vars to Lambda, without exposing all env vars as some of them might be private / unnecessary for app run.

commented

Consider .env file. In case .env file is present during build, it will load on start from it. Basically, next build propagates the file into output and we zip it then.

We should consider that .env file is gonna propagate to the final build and into the code.

Next server's priority when resolving env vars (from top):

process.env
.env.$(NODE_ENV).local
.env.local (Not checked when NODE_ENV is test.)
.env.$(NODE_ENV)
.env
commented

Support implemented by a85085d.
Version ^3.13.0