Strider-CD / strider-github

Github provider for strider
25 stars 34 forks source link

webhooks.js expecting objects to exist that do not #67

Open notbrain opened 8 years ago

notbrain commented 8 years ago

We have a simple setup of 3 branches that auto-build when updated, but master does not. Wanted to get this here as a placeholder before I have time to dig in in case anyone else is working on this...some extra checking would avoid these errors but if I had to guess there is an underlying issue with webhooks firing on branches that are disabled.

2016-02-19T00:30:11.474Z - error: TypeError: Cannot read property 'author' of null
    at pushJob (/home/ubuntu/striderCD/node_modules/strider-github/lib/webhooks.js:166:19)
    at startFromCommit (/home/ubuntu/striderCD/node_modules/strider-github/lib/webhooks.js:49:16)
    at receiveWebhook (/home/ubuntu/striderCD/node_modules/strider-github/lib/webhooks.js:262:16)
    at Layer.handle [as handle_request] (/home/ubuntu/striderCD/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/ubuntu/striderCD/node_modules/express/lib/router/route.js:131:13)
    at projectProvider (/home/ubuntu/striderCD/lib/middleware.js:120:3)
    at Layer.handle [as handle_request] (/home/ubuntu/striderCD/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/ubuntu/striderCD/node_modules/express/lib/router/route.js:131:13)
    at Promise.<anonymous> (/home/ubuntu/striderCD/lib/middleware.js:239:7)
    at Promise.<anonymous> (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:177:8)
    at emitOne (events.js:90:13)
    at Promise.emit (events.js:182:7)
    at Promise.emit (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:84:38)
    at Promise.fulfill (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:97:20)
    at Promise.resolve (/home/ubuntu/striderCD/node_modules/mongoose/lib/promise.js:114:23)
    at Promise.<anonymous> (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:177:8)
    at emitOne (events.js:90:13)
    at Promise.emit (events.js:182:7)
    at Promise.emit (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:84:38)
    at Promise.fulfill (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:97:20)
    at /home/ubuntu/striderCD/node_modules/mongoose/lib/query.js:1406:13
    at model.Document.init (/home/ubuntu/striderCD/node_modules/mongoose/lib/document.js:254:11)
2016-02-19T02:40:20.295Z - error: TypeError: Cannot read property 'message' of undefined
    at startFromCommit (/home/ubuntu/striderCD/node_modules/strider-github/lib/webhooks.js:52:17)
    at receiveWebhook (/home/ubuntu/striderCD/node_modules/strider-github/lib/webhooks.js:262:16)
    at Layer.handle [as handle_request] (/home/ubuntu/striderCD/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/ubuntu/striderCD/node_modules/express/lib/router/route.js:131:13)
    at projectProvider (/home/ubuntu/striderCD/lib/middleware.js:120:3)
    at Layer.handle [as handle_request] (/home/ubuntu/striderCD/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/ubuntu/striderCD/node_modules/express/lib/router/route.js:131:13)
    at Promise.<anonymous> (/home/ubuntu/striderCD/lib/middleware.js:239:7)
    at Promise.<anonymous> (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:177:8)
    at emitOne (events.js:90:13)
    at Promise.emit (events.js:182:7)
    at Promise.emit (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:84:38)
    at Promise.fulfill (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:97:20)
    at Promise.resolve (/home/ubuntu/striderCD/node_modules/mongoose/lib/promise.js:114:23)
    at Promise.<anonymous> (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:177:8)
    at emitOne (events.js:90:13)
    at Promise.emit (events.js:182:7)
    at Promise.emit (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:84:38)
    at Promise.fulfill (/home/ubuntu/striderCD/node_modules/mpromise/lib/promise.js:97:20)
    at /home/ubuntu/striderCD/node_modules/mongoose/lib/query.js:1406:13
    at model.Document.init (/home/ubuntu/striderCD/node_modules/mongoose/lib/document.js:254:11)
    at completeOne (/home/ubuntu/striderCD/node_modules/mongoose/lib/query.js:1404:10)
knownasilya commented 8 years ago

First that I'm seeing this, so most likely no one is working on it. Go right ahead with that PR :wink:

xgalen commented 8 years ago

I've just found the same bug. This appears when the webhook is triggered by some events like Created or Deleted because these properties are not sent by GitHub. The solution could be to put some text as default. I will send a PR today or tomorrow.