diff --git a/package/lib/compileFunctions.js b/package/lib/compileFunctions.js index d24afbf..22e1d08 100644 --- a/package/lib/compileFunctions.js +++ b/package/lib/compileFunctions.js @@ -46,10 +46,13 @@ module.exports = { 'nodejs8'; funcTemplate.properties.timeout = _.get(funcObject, 'timeout') || _.get(this, 'serverless.service.provider.timeout') || '60s'; - funcTemplate.properties.environmentVariables = _.merge( - {}, - _.get(this, 'serverless.service.provider.environment'), - funcObject.environment // eslint-disable-line comma-dangle + funcTemplate.properties.environmentVariables = _.mapValues( + _.merge( + {}, + _.get(this, 'serverless.service.provider.environment'), + funcObject.environment // eslint-disable-line comma-dangle + ), + (value) => value.toString() // eslint-disable-line comma-dangle ); if (!funcTemplate.properties.serviceAccountEmail) { diff --git a/package/lib/compileFunctions.test.js b/package/lib/compileFunctions.test.js index cfdc6f4..6cfbad5 100644 --- a/package/lib/compileFunctions.test.js +++ b/package/lib/compileFunctions.test.js @@ -376,6 +376,8 @@ describe('CompileFunctions', () => { handler: 'func1', environment: { TEST_VAR: 'test', + TEST_VAR_NUMBER: 123, + TEST_VAR_BOOL: false, }, events: [{ http: 'foo' }], }, @@ -393,6 +395,8 @@ describe('CompileFunctions', () => { availableMemoryMb: 256, environmentVariables: { TEST_VAR: 'test', + TEST_VAR_NUMBER: '123', + TEST_VAR_BOOL: 'false', }, timeout: '60s', sourceArchiveUrl: 'gs://sls-my-service-dev-12345678/some-path/artifact.zip',