diff --git a/lib/utils/yamlAstParser.js b/lib/utils/yamlAstParser.js index ff6d4435e..a86c7d4dd 100644 --- a/lib/utils/yamlAstParser.js +++ b/lib/utils/yamlAstParser.js @@ -5,6 +5,7 @@ const BbPromise = require('bluebird'); const fs = BbPromise.promisifyAll(require('fs')); const _ = require('lodash'); const os = require('os'); +const chalk = require('chalk'); const findKeyChain = (astContent) => { let content = astContent; @@ -24,6 +25,11 @@ const parseAST = (ymlAstContent, astObject) => { let newAstObject = astObject || {}; if (ymlAstContent.mappings && _.isArray(ymlAstContent.mappings)) { _.forEach(ymlAstContent.mappings, (v) => { + if (!v.value) { + console.log(`Serverless: ${chalk.red(`Your serverless.yml has an invalid value with key: ${v.key.value}. Ignoring...`)}`); + return; + } + if (v.key.kind === 0 && v.value.kind === 0) { newAstObject[findKeyChain(v)] = v.value; } else if (v.key.kind === 0 && v.value.kind === 2) {