bugsnag / bugsnag-node

[DEPRECATED] Please upgrade to our Universal JS notifier "@bugsnag/js" • https://github.com/bugsnag/bugsnag-js
https://www.bugsnag.com/
MIT License
48 stars 55 forks source link

Duplicate Error Messages in Logs #123

Closed jameskerr closed 6 years ago

jameskerr commented 6 years ago

Expected behavior

In development without a bugsnag API key, I expect to only see an single error message printed to the console when a single error occurs.

Observed behavior

Duplicate error messages are printed to the console.

...
Bugsnag:  apiKey not being set prevents the following error from being sent to Bugsnag.
https://docs.bugsnag.com/platforms/nodejs/other/#basic-configuration

ReferenceError: idontexist is not defined
    at Object.notifications (/Users/jkerr/Projects/looky/server/src/interfaces/slack/events-outbound.js:200:5)
    at Promise.map.notification (/Users/jkerr/Projects/looky/server/src/interfaces/index.js:14:34)
    at tryCatcher (/Users/jkerr/Projects/looky/server/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled 

Bugsnag:  ReferenceError: idontexist is not defined
    at Object.notifications (/Users/jkerr/Projects/looky/server/src/interfaces/slack/events-outbound.js:200:5)
    at Promise.map.notification (/Users/jkerr/Projects/looky/server/src/interfaces/index.js:14:34)
    at tryCatcher (/Users/jkerr/Projects/looky/server/node_modules/bluebird/js/release/util.js:16:23)
    at MappingPromiseArray._promiseFulfilled 
...

Steps to reproduce

  1. Add bugsnag to an express app following the instructions on the bugsnag website.
  2. Insert null for the
  3. Trigger an error

Version

2.0.1

Additional information

The error first gets printed here: https://github.com/bugsnag/bugsnag-node/blob/master/lib/bugsnag.js#L72

Then it gets printed again here: https://github.com/bugsnag/bugsnag-node/blob/master/lib/configuration.js#L39

jameskerr commented 6 years ago

I'd recommend not including the error the error message here: https://github.com/bugsnag/bugsnag-node/blob/master/lib/bugsnag.js#L72