This repository has been archived by the owner. It is now read-only.

Pagerduty webhook doesnt work #1295

Closed
johntdyer opened this Issue Feb 2, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@johntdyer

I am having a hard time getting the pager duty hook to work, I am not sure I know enough node to debug so I was hoping to get some eye on this error


# jdyer at retina.local in ~/
$ curl -X POST -d '{"messages":[{"type":"incident.trigger","data":{"incident":{"id":"PJXXXX","incident_number":4266,"created_on":"2014-02-02T13:01:08-05:00","status":"triggered","html_url":"http://xxxxxxxx.pagerduty.com/incidents/PJXXXX","incident_key":"76e175c993fc401b9d8e0bf46767857c","service":{"id":"PH9WEVI","name":"Sensu","html_url":"http://xxxxxxxx.pagerduty.com/services/PH9WEVI","deleted_at":null},"escalation_policy":{"id":"P115HOG","name":"Engineering"},"assigned_to_user":{"id":"P8XXXXX","name":"Jake Herbst","email":"jherbst@xxxxxx.com","html_url":"http://xxxxxxxx.pagerduty.com/users/P8XXXXX"},"trigger_summary_data":{"subject":"testing please ignore"},"trigger_details_html_url":"http://xxxxxxxx.pagerduty.com/incidents/PJXXXX/log_entries/P88SXJR","trigger_type":"web_trigger","last_status_change_on":"2014-02-02T13:01:08-05:00","last_status_change_by":null,"number_of_escalations":0}},"id":"fe4c97a0-8c33-11e3-b1e9-12313f045428","created_on":"2014-02-02T18:01:08Z"}]}' -H "application/json" http://503cc3fe.ngrok.com/pg-hooks
TypeError: Cannot read property '0' of undefined
  at parseWebhook (/Users/administrator/hubot/node_modules/hubot-scripts/src/scripts/pagerduty.coffee:419:37)
  at /Users/administrator/hubot/node_modules/hubot-scripts/src/scripts/pagerduty.coffee:492:36
  at callbacks (/Users/administrator/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:161:37)
  at param (/Users/administrator/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:135:11)
  at pass (/Users/administrator/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:142:5)
  at Router._dispatch (/Users/administrator/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:170:5)
  at Object.router (/Users/administrator/hubot/node_modules/hubot/node_modules/express/lib/router/index.js:33:10)
  at next (/Users/administrator/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/proto.js:190:15)
  at multipart (/Users/administrator/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/multipart.js:60:27)
  at /Users/administrator/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:9
  at IncomingMessage.<anonymous> (/Users/administrator/hubot/node_modules/hubot/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:70:11)
  at IncomingMessage.EventEmitter.emit (events.js:92:17)
  at _stream_readable.js:920:16
  at process._tickCallback (node.js:415:13)
@technicalpickles

This comment has been minimized.

Show comment Hide comment
@technicalpickles

technicalpickles Feb 3, 2014

Member

cc @silas @gregone as folks that have worked on the webhook endpoint before

Member

technicalpickles commented Feb 3, 2014

cc @silas @gregone as folks that have worked on the webhook endpoint before

@technicalpickles

This comment has been minimized.

Show comment Hide comment
@technicalpickles

technicalpickles Feb 3, 2014

Member

The stack line items doesn't look quite right, unfortunately. What version of coffeescript are you using? (newer ones seem to fix that)

From memory, TypeError: Cannot read property '0' of undefined tend to come up places using like passing something[0] around, and then not checking its existence... which happens in a few places in the script.

Member

technicalpickles commented Feb 3, 2014

The stack line items doesn't look quite right, unfortunately. What version of coffeescript are you using? (newer ones seem to fix that)

From memory, TypeError: Cannot read property '0' of undefined tend to come up places using like passing something[0] around, and then not checking its existence... which happens in a few places in the script.

@johntdyer

This comment has been minimized.

Show comment Hide comment
@johntdyer

johntdyer Feb 3, 2014

1.7.1

mackens:~ administrator$ coffee -v
CoffeeScript version 1.7.1
mackens:~ administrator$

1.7.1

mackens:~ administrator$ coffee -v
CoffeeScript version 1.7.1
mackens:~ administrator$
@silas

This comment has been minimized.

Show comment Hide comment
@silas

silas Feb 3, 2014

Contributor

The content type you set in the curl request is wrong, did you mean:

-H 'Content-Type: application/json'

my guess would be that its not decoding correctly (I don't have an active hubot setup anymore, so I can really test it).

Contributor

silas commented Feb 3, 2014

The content type you set in the curl request is wrong, did you mean:

-H 'Content-Type: application/json'

my guess would be that its not decoding correctly (I don't have an active hubot setup anymore, so I can really test it).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.