Cannot set property 'S3Key' of undefined

aws

#1

Output of serverless deploy --debug w/ SLS_DEBUG=’*’

No idea what to look for. Any help would be appreciated.

  Type Error ---------------------------------------------

Cannot set property ‘S3Key’ of undefined

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Stack Trace --------------------------------------------

TypeError: Cannot set property ‘S3Key’ of undefined
at _.forEach (/usr/local/lib/node_modules/serverless/lib/plugins/aws/lib/normalizeFiles.js:13:38)
at /usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:4944:15
at baseForOwn (/usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:3001:24)
at /usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:4913:18
at Function.forEach (/usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:9359:14)
at Object.normalizeCloudFormationTemplate (/usr/local/lib/node_modules/serverless/lib/plugins/aws/lib/normalizeFiles.js:10:7)
at AwsDeploy.checkIfDeploymentIsNecessary (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/checkForChanges.js:89:45)
From previous event:
at AwsDeploy.checkForChanges (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/checkForChanges.js:22:8)
From previous event:
at Object.aws:deploy:deploy:checkForChanges [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:102:10)
at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:378:17)
at AwsDeploy.BbPromise.bind.then (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:91:48)
From previous event:
at Object.deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/aws/deploy/index.js:87:10)
at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:17)
at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:666:20)
at tryOnImmediate (timers.js:639:5)
at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:39:50)


#2

You wouldn’t happen to be listing one of your lambda functions under the resources section would you? Something like this:

resources:
  Resources:
    lambdaFnName:
      Type: AWS::Lambda::Function
      Properties:
        ...

It appears that if you add a lambda under the resources section, the Code field is required and the error handling for a missing Code field is pretty poor (as in non-existent).