From e2eef3045382d2c13e4fa01d5da1d27dc9fb3314 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 14 Sep 2017 22:38:05 -0700 Subject: [PATCH] warn if bad value --- lib/utils/yamlAstParser.js | 6 ++++++ 1 file changed, 6 insertions(+) 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) {