Skip to content

Crash when Pushover API responds with HTML #25

@sulkaharo

Description

@sulkaharo

I just had an app crash and the stack trace indicates the issue is with the node-pushover library not handling the API not responding with a JSON object. Add some defensive code somewhere to check if the response actually parses as JSON? :)

  • Jul 01 09:02:23 app/web.1: <!doctype html>
  • Jul 01 09:02:23 app/web.1: ^
  • Jul 01 09:02:23 app/web.1: SyntaxError: Unexpected token < in JSON at position 0
  • Jul 01 09:02:23 app/web.1:     at JSON.parse ()
  • Jul 01 09:02:23 app/web.1:     at Pushover.errors (/app/node_modules/pushover-notifications/lib/pushover.js:134:14)
  • Jul 01 09:02:23 app/web.1:     at IncomingMessage. (/app/node_modules/pushover-notifications/lib/pushover.js:241:12)
  • Jul 01 09:02:23 heroku/web.1: State changed from up to crashed
  • Jul 01 09:02:23 app/web.1:     at IncomingMessage.emit (events.js:203:15)
  • Jul 01 09:02:23 app/web.1:     at endReadableNT (_stream_readable.js:1129:12)
  • Jul 01 09:02:23 app/web.1:     at process._tickCallback (internal/process/next_tick.js:63:19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions