Search code examples
node.jserror-handlingbugsnag

Report not sent due to releaseStage/notifyReleaseStages configuration


I want to send errors to my created stages by property notifyReleaseStage

const app               = express();
const bugsnag           = require('@bugsnag/js');
const bugsnagClient     = bugsnag({
    apiKey: process.env.bugsnag_api_key,
    onUnhandledRejection: function (err) {
        log("Unhandled Rejection >>>>>> reason >>>>>>", err.message)
    },
    notifyReleaseStages: ['local']
});
bugsnagClient.use(require('@bugsnag/plugin-express'));
const { requestHandler, errorHandler } = bugsnagClient.getPlugin('express');
app.use(requestHandler);
app.use(errorHandler)

but when I throw an error it writes in the console :

[bugsnag] Report not sent due to releaseStage/notifyReleaseStages configuration


Solution

  • The notifyReleaseStages setting affects which release stages report errors to Bugsnag (for any that you don't list in that setting the library will prevent sending any error reports): https://docs.bugsnag.com/platforms/javascript/express/configuration-options/#notifyreleasestages

    The release stage will default to 'production' but can be set to another release stage by setting the releaseStage option: https://docs.bugsnag.com/platforms/javascript/express/configuration-options/#releasestage

    It sounds like you want to set the release stage so you should be using releaseStage not notifyReleaseStages.