AWS_LAMBDA_JS_RUNTIME - nodejs14.x

I spent a few hours troubleshooting this today as well :slight_smile:

It seems that the AWS_LAMBDA_JS_RUNTIME environment variable has to be specified in the website UI specifically.

Right now even if I specify it for all contexts in netlify.toml it does not get applied:

[build]
# https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript
environment = { NODE_VERSION = "14", AWS_LAMBDA_JS_RUNTIME = "nodejs14.x" }

[context.production.environment]
# https://docs.netlify.com/functions/build-with-javascript/#runtime-settings
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
NODE_VERSION = "14"
AWS_LAMBDA_JS_RUNTIME = "nodejs14.x"

[context.deploy-preview.environment]
NODE_VERSION = "14"
AWS_LAMBDA_JS_RUNTIME = "nodejs14.x"

However, if I set the environment variable on the website UI, it does work.
This seems to have an issue with the environment variables from the configuration file.

According to Build environment variables | Netlify Docs

Environment variables set in the UI are also accessible in other environments associated with your site, including serverless functions at execution time, snippet injection during post processing, and more.

Which means only UI environment variables are shared with AWS Lambda, which is a bit weird.