serverless-plugin-bind-deployment-id icon indicating copy to clipboard operation
serverless-plugin-bind-deployment-id copied to clipboard

Cannot read property 'Properties' of undefined

Open manjirinamjoshi opened this issue 6 years ago • 6 comments

Hello,

I am getting this error for "sls deploy --stage dev" -

TypeError: Cannot read property 'Properties' of undefined at BindDeploymentId.fixUpDeploymentStage (/et/repo/serverless/channel/node_modules/serverless-plugin-bind-deployment-id/lib/index.js:70:32) at BindDeploymentId.bindDeploymentId (/et/repo/serverless/channel/node_modules/serverless-plugin-bind-deployment-id/lib/index.js:48:35)

My serverless.yml has functions and API Gateway resources and methods.

When I decide to have a trigger for atleast 1 function then this error doesnt appear. But, if none of my lambda functions have a trigger then this errors pops up.

serverless.yml contents are - https://gist.github.com/manjirinamjoshi/ca3900cd814d654e955af9ed069a0b35

Thank you

Sincerely, Manjiri

manjirinamjoshi avatar Aug 01 '18 16:08 manjirinamjoshi

Hi @manjirinamjoshi thanks for the bug report! The issue here is that Serverless only creates a resource of type AWS::ApiGateway::Deployment when you actually hook up a function to an endpoint. Without that, this plugin doesn't really serve much of a purpose. However, to fix the issue, you could log a warning and return out of bindDeploymentId in src/index if the deploymentId is unset. Happy to approve a PR if you put on up. Thanks again!

jacob-meacham avatar Aug 01 '18 21:08 jacob-meacham

Thank you so much for your reply. And, my apologies, I am very new to serverless world. On my local, tried to return out if bindDeploymentId, but ran into this error -

Unresolved resource dependencies [ApiGatewayRestApi] in the Resources block of the template

Any thoughts ?

Thank you

Sincerely, Manjiri

manjirinamjoshi avatar Aug 01 '18 22:08 manjirinamjoshi

` E:\Work\Satish\serverless\my-app\node_modules\webpack-cli\bin\config-yargs.js:136 describe: optionsSchema.definitions.output.properties.path.description,

^

TypeError: Cannot read property 'properties' of undefined at module.exports (E:\Work\Satish\serverless\my-app\node_modules\webpack-cli\bin\config-yargs.js:136:48) at E:\Work\Satish\serverless\my-app\node_modules\webpack-cli\bin\webpack.js:59:27 at Object. (E:\Work\Satish\serverless\my-app\node_modules\webpack-cli\bin\webpack.js:514:3) at Module._compile (internal/modules/cjs/loader.js:955:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) at Module.load (internal/modules/cjs/loader.js:811:32) at Function.Module._load (internal/modules/cjs/loader.js:723:14) at Module.require (internal/modules/cjs/loader.js:848:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (E:\Work\Satish\serverless\my-app\node_modules\webpack\bin\webpack.js:156:2) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:server:serverless: ng run my-app:server:serverless && webpack --config webpack.server.config.js --progress --colors npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build:server:serverless script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SatishPc\AppData\Roaming\npm-cache_logs\2020-02-24T17_26_44_216Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:serverless: npm run build:browser:serverless && npm run build:server:serverless npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build:serverless script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SatishPc\AppData\Roaming\npm-cache_logs\2020-02-24T17_26_44_264Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build:serverless:deploy: npm run build:serverless && npm run deploy npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build:serverless:deploy script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SatishPc\AppData\Roaming\npm-cache_logs\2020-02-24T17_26_44_308Z-debug.log `

developersatish avatar Feb 24 '20 17:02 developersatish

Hi @developersatish thanks for the report - can you give me some more information:

  • What version of serverless are you running?
  • What version of the plugin are you using?
  • What other serverless plugins do you have?

jacob-meacham avatar Mar 02 '20 03:03 jacob-meacham

I had the same issue, and it was resolved by adding an event. output from serverless --version Framework Core: 1.79.0 Plugin: 3.7.1 SDK: 2.3.1 Components: 2.34.6

Plugins and versions: "serverless-cloudformation-changesets": "0.0.2", "serverless-dependson-plugin": "^1.1.2", "serverless-deployment-bucket": "^1.1.2", "serverless-plugin-bind-deployment-id": "^1.2.0", "serverless-plugin-create-deployment-bucket": "0.0.2", "serverless-plugin-tracing": "^2.0.0"

This isn't a huge issue, we didn't intend to have a function without any triggers. If we did we would remove this plugin.

troybESM avatar Sep 03 '20 21:09 troybESM

I just tried to migrate all of my functions from using http (API Gateway REST API) to httpApi (API Gateway HTTP API) and I got this same error. Read more here.

OK. I see that I forgot about the RestAPI Stage and the custom domain name mapping, etc. That's probably what's going on.

rsshilli avatar Sep 17 '21 15:09 rsshilli