以下代码独立工作并发送消息(node filename.js with "style": "module" in package.json)
import * as Sentry from "@sentry/node";
Sentry.init({
dsn: "http://id@host/number",
});
Sentry.captureMessage('testing sentry 2');
在 oclif 的 run
函数中使用完全相同的函数失败,没有任何消息(在文件顶部导入):
async run(): Promise<void> {
const { flags } = this.parse(FileName)
Sentry.init({
dsn: 'http://id@host/number',
})
Sentry.captureMessage('testing sentry 3')
// further code, runs
如何调试/使其工作(也在 https://forum.sentry.io/t/using-sentry-with-oclif-for-cli/12815 和 https://github.com/oclif/oclif/issues/497 中)?