fix: Fix functions[] validation (ignore null values)

This commit is contained in:
Mariusz Nowak 2021-07-16 10:18:21 +02:00 committed by Mariusz Nowak
parent daee1d5375
commit 922ec0093f
2 changed files with 5 additions and 1 deletions

View File

@ -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(

View File

@ -135,7 +135,7 @@ describe('Service', () => {
command: 'package',
configExt: {
functions: {
bar: null,
bar: true,
},
},
})