From 900119ab9008691f0d67b27281aee044cc63a658 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Thu, 29 Aug 2019 11:16:55 +0300 Subject: [PATCH] fix(lambda): environment var values are strings 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 --- packages/@aws-cdk/aws-lambda/lib/function.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda/lib/function.ts b/packages/@aws-cdk/aws-lambda/lib/function.ts index d97455a11b2c5..4c9379c38d8c9 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function.ts @@ -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. @@ -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, { @@ -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;