我想通过属性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)
但是当我抛出错误时,它会在控制台中写入:
[bugsnag] Report not sent due to releaseStage/notifyReleaseStages configuration
最佳答案
notifyReleaseStages
设置会影响哪些发布阶段向 Bugsnag 报告错误(对于您未在该设置中列出的任何阶段,库将阻止发送任何错误报告):
https://docs.bugsnag.com/platforms/javascript/express/configuration-options/#notifyreleasestages
发布阶段默认为“生产”,但可以通过设置 releaseStage
选项设置为另一个发布阶段:
https://docs.bugsnag.com/platforms/javascript/express/configuration-options/#releasestage
听起来您想设置发布阶段,因此您应该使用 releaseStage
而不是 notifyReleaseStages
。
关于node.js - 由于releaseStage/notifyReleaseStages配置而未发送报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57906450/