developmentseed / jekyll-hook

No Longer Maintained | A server that listens for GitHub webhook posts and renders a Jekyll site
BSD 3-Clause "New" or "Revised" License
508 stars 83 forks source link

TypeError: Cannot call method 'replace' of undefined #37

Open sammcj opened 9 years ago

sammcj commented 9 years ago

When the hook is triggered the following error occurred and the build is not triggered:

./jekyll-hook.js
connect deprecated urlencoded.verify: use body-parser module for verify node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:55:21
connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:56:20
connect deprecated limit: Restrict request size at location of read node_modules/express/node_modules/connect/lib/middleware/multipart.js:86:15
connect deprecated json.verify: use body-parser module for verify node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:15
Listening on port 8080
TypeError: Cannot call method 'replace' of undefined
    at /opt/jekyll-hook/jekyll-hook.js:52:32
    at pop (/opt/jekyll-hook/node_modules/queue-async/queue.js:24:14)
    at Object.q.defer (/opt/jekyll-hook/node_modules/queue-async/queue.js:55:11)
    at port (/opt/jekyll-hook/jekyll-hook.js:45:11)
    at callbacks (/opt/jekyll-hook/node_modules/express/lib/router/index.js:164:37)
    at param (/opt/jekyll-hook/node_modules/express/lib/router/index.js:138:11)
    at pass (/opt/jekyll-hook/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/opt/jekyll-hook/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/opt/jekyll-hook/node_modules/express/lib/router/index.js:33:10)
    at next (/opt/jekyll-hook/node_modules/express/node_modules/connect/lib/proto.js:174:15)
jflasher commented 9 years ago

Hi @sammcj , this looks like the server is just getting an unhandled event type that doesn't contain the ref property. When setting up the webhook, you may just want to select only the PushEvent which should resolve the issue.

sfunk1x commented 8 years ago

I am actually having this issue as well. My configuration:

TypeError: Cannot read property 'replace' of undefined
    at /var/www/jekyll-hook/jekyll-hook.js:52:31
    at pop (/var/www/jekyll-hook/node_modules/queue-async/queue.js:24:14)
    at Object.q.defer (/var/www/jekyll-hook/node_modules/queue-async/queue.js:55:11)
    at /var/www/jekyll-hook/jekyll-hook.js:45:11
    at callbacks (/var/www/jekyll-hook/node_modules/express/lib/router/index.js:164:37)
    at param (/var/www/jekyll-hook/node_modules/express/lib/router/index.js:138:11)
    at pass (/var/www/jekyll-hook/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/var/www/jekyll-hook/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/var/www/jekyll-hook/node_modules/express/lib/router/index.js:33:10)
    at next (/var/www/jekyll-hook/node_modules/express/node_modules/connect/lib/proto.js:174:15)

UPDATE 08/21/15: The problem was that I was 'testing' the webhook via Github's web GUI. This doesn't work, as it doesn't send all of the data that a regular push would. If you actually push some data to the repo, you'll force an execution of a webhook with a proper payload, and Jekyll-Hook will work beautifully.