Closed oliversalzburg closed 9 years ago
I also have this kind of issue after a push on github:
TypeError: Cannot call method 'indexOf' of undefined
at pushJob (/home/strider/strider/node_modules/strider-github/lib/webhooks.js:126:19)
at startFromCommit (/home/strider/strider/node_modules/strider-github/lib/webhooks.js:42:16)
at receiveWebhook (/home/strider/strider/node_modules/strider-github/lib/webhooks.js:222:3)
at callbacks (/home/strider/strider/node_modules/express/lib/router/index.js:164:37)
at projectProvider (/home/strider/strider/lib/middleware.js:107:3)
at callbacks (/home/strider/strider/node_modules/express/lib/router/index.js:164:37)
at Promise.<anonymous> (/home/strider/strider/lib/middleware.js:201:5)
at Promise.<anonymous> (/home/strider/strider/node_modules/mongoose/node_modules/mpromise/lib/promise.js:162:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/home/strider/strider/node_modules/mongoose/node_modules/mpromise/lib/promise.js:79:38)
So it is caused by this line:
if (payload.ref.indexOf('refs/heads/') === 0) {
branchname = payload.ref.substring('refs/heads/'.length)
ref = {
branch: branchname,
id: payload.after
}
} else {
although, in the payload in the request, I have the ref property
"ref": "refs/heads/jelix-1.6.x",
@laurentj That was fixed by https://github.com/Strider-CD/strider-github/pull/16 Unless I'm mistaken :)
@oliversalzburg yes, you're right. I didn't saw the fix about JSON.parse...
Latest HEAD of strider-github is now on npm as v1.2.2. But you can confirm that there is still an issue with Github web hooks?
@niallo Our setup seems to work fine now. I think the problem I was seeing is only related to that initial ping sent by GitHub when the webhook is set up.
Same error this side, maybe npm
version is outdated?
@cusspvz did you solve the issue?
Yes, I don't quite remember this but things are working flawless at the time.
Thanks @cusspvz
Today I noticed that our strider is no longer processing commits from our projects.
When looking into the issue, I noticed some problems which were apparently fixed by https://github.com/Strider-CD/strider-github/pull/16 (please but another release to NPM btw). Even after I applied those changes to our install, I still see the following response on GitHub:
I see that error for the test request that GitHub sends when you add a new hook.