Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-lambda-nodejs: Bundled environment variables aren't present in CF template #26893

Closed
ashtonmoomoo opened this issue Aug 26, 2023 · 2 comments
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@ashtonmoomoo
Copy link

Describe the bug

Environment variables specified in the NodejsFunctionProps.bundling.environment key in the NodejsFunction constructor don't appear in the outputted CloudFormation template, or in process.env in the function's handler.

Expected Behavior

Values specified in NodejsFunctionProps.bundling.environment should be present in the CloudFormation template and in process.env in the function handler.

Current Behavior

Values don't appear in CloudFormation template and are undefined in the function's handler when accessed via process.env.

Reproduction Steps

Code and reproduction steps can be found in this repo: https://github.com/ashtonmoomoo/aws-lambda-nodejs-bug

Possible Solution

No response

Additional Information/Context

Work around at the moment is to add them to the function manually with this.addEnvironment(key, value).

CDK CLI Version

2.92.0 (build bf62e55)

Framework Version

No response

Node.js Version

v18.7.0

OS

macOS Ventura 13.4.1 (c)

Language

Typescript

Language Version

Typescript 5.1.6

Other information

No response

@ashtonmoomoo ashtonmoomoo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 26, 2023
@ashtonmoomoo
Copy link
Author

My mistake, environment variables should be added in NodejsFunctionProps.environment. 🤦

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant