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

fix(lambda): environment var values are strings #3858

Merged
merged 7 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ removed:@aws-cdk/aws-apigateway.HttpIntegration.props
removed:@aws-cdk/aws-apigateway.Integration.props
removed:@aws-cdk/aws-apigateway.LambdaIntegration.props
removed:@aws-cdk/aws-apigateway.MockIntegration.props
incompatible-argument:@aws-cdk/aws-lambda.Function.<initializer>
incompatible-argument:@aws-cdk/aws-lambda.SingletonFunction.<initializer>
incompatible-argument:@aws-cdk/aws-lambda.Function.addEnvironment
10 changes: 3 additions & 7 deletions packages/@aws-cdk/aws-lambda/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export interface FunctionProps {
*
* @default - No environment variables.
*/
readonly environment?: { [key: string]: any };
readonly environment?: { [key: string]: string };

/**
* The runtime environment for the Lambda function that you are uploading.
Expand Down Expand Up @@ -392,7 +392,7 @@ export class Function extends FunctionBase {
/**
* Environment variables for this function
*/
private readonly environment?: { [key: string]: any };
private readonly environment: { [key: string]: string };

constructor(scope: Construct, id: string, props: FunctionProps) {
super(scope, id, {
Expand Down Expand Up @@ -491,11 +491,7 @@ export class Function extends FunctionBase {
* @param key The environment variable key.
* @param value The environment variable's value.
*/
public addEnvironment(key: string, value: any): this {
if (!this.environment) {
// TODO: add metadata
return this;
}
public addEnvironment(key: string, value: string): this {
this.environment[key] = value;
return this;
}
Expand Down