Sentry与React / Node应用程序集成 - 当前版本没有问题

时间:2018-05-24 12:55:32

标签: javascript webpack sentry

这是我第一次尝试将Sentry集成到我的项目中:

这是我添加到plugins中的内容:

import SentryPlugin from 'webpack-sentry-plugin';
new SentryPlugin({
      organization: 'my-org',
      project: 'my-project',
      apiKey: 'myAPIKey',
      release: provess.env.GIT_COMMIT_HASH,
    });

在构建中,我可以看到生成了源图,它们与常规JS文件具有相同的名称,但只添加了.map

我还配置了Raven

import Raven from 'raven-js';
const initializeRaven = () => {
    const configuration = { /* some ignoreUrls and ignoreErrors options from https://docs.sentry.io/clients/javascript/tips/ */ };
    const commitHash = process.env.GIT_COMMIT_HASH;
    if (commitHash) configuration.release = commitHash;
    const sentryDSN = 'my-sentry-dsn';
    try {
        Raven
            .config(sentryDSN, configuration)
            .install();
        console.log('Integrated Sentry...', Raven);
     } catch (e) {
         console.error('Failed to integrate Sentry');
     }
};

现在登录sentry.io时,我可以在我的版本中看到最新版本。但是在调查发布的问题时,没有。并且出现的最新问题将版本设置为n/a

当我预料到错误时(例如componentDidCatch)我只会使用:

const extra = { method: 'request-method', url: 'request-url' };
Raven.captureMessage(error.message, { level: 'error', extra });

我错过了什么?

0 个答案:

没有答案