Skip to content

Commit

Permalink
fix: Improve functions validation
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Jul 14, 2021
1 parent a0dc074 commit 3e58d62
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/classes/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ class Service {

// Ensure that function is an object and setup function.name property
const stageNameForFunction = options.stage || this.provider.stage;

if (!_.isObject(this.functions)) {
throw new ServerlessError(
`Unexpected "functions" configuration: Expected object received: ${util.inspect(
this.functions
)}`,
'NON_OBJECT_FUNCTIONS_CONFIGURATION'
);
}
Object.entries(this.functions).forEach(([functionName, functionObj]) => {
if (!_.isObject(functionObj)) {
throw new ServerlessError(
Expand Down

0 comments on commit 3e58d62

Please sign in to comment.