qbit / node-pushover

Pushover notifications for node.js (JavaScript,NodeJS)
ISC License
163 stars 24 forks source link

Crashing application on incorrect user key #28

Open DanrwAU opened 4 years ago

DanrwAU commented 4 years ago

Library is not returning err correctly when incorrect user key is set.

Code we're using to send messages

p.send(msg, function (err, result) {
              if (err) { logger.main.error('Pushover:' + err); }
              logger.main.debug('Pushover:' + result);
              callback();
            });

Results in a crash with an unhandled exception

3|pagermon-test  | Error: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  |     at Pushover.errors (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:145:13)
3|pagermon-test  |     at IncomingMessage.<anonymous> (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:249:12)
3|pagermon-test  |     at IncomingMessage.emit (events.js:194:15)
3|pagermon-test  |     at IncomingMessage.EventEmitter.emit (domain.js:441:20)
3|pagermon-test  |     at endReadableNT (_stream_readable.js:1125:12)
3|pagermon-test  |     at process._tickCallback (internal/process/next_tick.js:63:19)
3|pagermon-test  | [pmon]  2020-01-27 08:16:40  error : uncaughtException: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  | Error: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  |     at Pushover.errors (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:145:13)
3|pagermon-test  |     at IncomingMessage.<anonymous> (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:249:12)
3|pagermon-test  |     at IncomingMessage.emit (events.js:194:15)
3|pagermon-test  |     at IncomingMessage.EventEmitter.emit (domain.js:441:20)
3|pagermon-test  |     at endReadableNT (_stream_readable.js:1125:12)
3|pagermon-test  |     at process._tickCallback (internal/process/next_tick.js:63:19)
3|pagermon-test  | uncaughtException: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  | Error: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  |     at Pushover.errors (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:145:13)
3|pagermon-test  |     at IncomingMessage.<anonymous> (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:249:12)
3|pagermon-test  |     at IncomingMessage.emit (events.js:194:15)
3|pagermon-test  |     at IncomingMessage.EventEmitter.emit (domain.js:441:20)
3|pagermon-test  |     at endReadableNT (_stream_readable.js:1125:12)
3|pagermon-test  |     at process._tickCallback (internal/process/next_tick.js:63:19)
3|pagermon-test  | [db]  2020-01-27 08:16:40  error : uncaughtException: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  | Error: user identifier is not a valid user, group, or subscribed user key
3|pagermon-test  |     at Pushover.errors (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:145:13)
3|pagermon-test  |     at IncomingMessage.<anonymous> (/home/daniel/pagermon-test/server/node_modules/pushover-notifications/lib/pushover.js:249:12)
3|pagermon-test  |     at IncomingMessage.emit (events.js:194:15)
3|pagermon-test  |     at IncomingMessage.EventEmitter.emit (domain.js:441:20)
3|pagermon-test  |     at endReadableNT (_stream_readable.js:1125:12)
3|pagermon-test  |     at process._tickCallback (internal/process/next_tick.js:63:19)

From what i can tell this only started happening in later versions.

https://github.com/pagermon/pagermon/issues/355

norenz92 commented 3 years ago

Having the same problem