Skip to content

Commit

Permalink
fix: fix env coerce function to work with mapValues
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Jun 25, 2020
1 parent 46fe9b9 commit 3fd3686
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions package/lib/compileFunctions.js
Expand Up @@ -199,16 +199,15 @@ const validateIamProperty = (funcObject, functionName) => {

const coerceEnvOrError = (result, key, value) => {
if (typeof value === 'string') {
result[key] = value;
return value;
} else if (typeof value === 'number') {
result[key] = value.toString();
} else {
const errorMessage = [
`The value for environment variable ${key} is an unsupported type: ${typeof value}.`,
' Values must either be strings or numbers (which are coerced into strings at package time).',
].join('');
throw new Error(errorMessage);
return value.toString();
}
const errorMessage = [
`The value for environment variable ${key} is an unsupported type: ${typeof value}.`,
' Values must either be strings or numbers (which are coerced into strings at package time).',
].join('');
throw new Error(errorMessage);
};

const getFunctionTemplate = (funcObject, projectName, region, sourceArchiveUrl) => {
Expand Down

0 comments on commit 3fd3686

Please sign in to comment.