Skip to content

Commit

Permalink
fix: Fix functions[] validation (ignore null values)
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Jul 16, 2021
1 parent daee1d5 commit 922ec00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/classes/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ class Service {
);
}
Object.entries(this.functions).forEach(([functionName, functionObj]) => {
if (functionObj == null) {
delete this.functions[functionName];
return;
}
if (!_.isObject(functionObj)) {
throw new ServerlessError(
`Unexpected "${functionName}" function configuration: Expected object received ${util.inspect(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lib/classes/Service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Service', () => {
command: 'package',
configExt: {
functions: {
bar: null,
bar: true,
},
},
})
Expand Down

0 comments on commit 922ec00

Please sign in to comment.