Skip to content

Commit

Permalink
fix(lambda): environment var values are strings
Browse files Browse the repository at this point in the history
AWS Lambda requires that all environment variables will be
strings but the API indicated `any` as the type of the value.
If users would pass in a non-string value, they would see an
error only during deployment.

Fixes #3337
  • Loading branch information
Elad Ben-Israel committed Aug 29, 2019
1 parent 5e4794b commit 900119a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 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,7 +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 {
public addEnvironment(key: string, value: string): this {
if (!this.environment) {
// TODO: add metadata
return this;
Expand Down

0 comments on commit 900119a

Please sign in to comment.