求助 sentry 配置 i 问题

114 天前
 SHEN22
{
    url: 'https://xxx
    project: 'xxx',
    authToken,
    org: 'sentry',
    sourcemaps: {
      filesToDeleteAfterUpload: 'dist/assets/*.map',
    },
    release: {
      name: 'v1.0.0',
      deploy: {
        env: 'production',
      },
      uploadLegacySourcemaps: [
        {
          urlPrefix: '~/assets/',
          ignore: ['./node_modules'],
          paths: ['dist/assets'],
        },
      ],
    },
    debug: true,
  };

log 显示 已经上传成功 后台也能看到相应的 sourceMap 但是报错的时候不显示具体的报错行数是怎么回事

976 次点击
所在节点    程序员
3 条回复
zzjjhh001
114 天前
能确定线上静态资源的访问路径,和 urlPrefix 配置的路径一致么?
有的静态资源都喜欢加点前缀啥的
SHEN22
113 天前
@zzjjhh001 http://xxx.com/assets/* 通过这样访问我是能访问到资源的 应该就没问题吧
zzjjhh001
113 天前
是的,可以本地试下生成的 sourcemap 文件有没有问题
gpt 代码 仅供参考
const { SourceMapConsumer } = require('source-map');
const fs = require('fs');

async function lookup() {
const mapObj = JSON.parse(fs.readFileSync('app.min.js.map', 'utf8'));
const consumer = await new SourceMapConsumer(mapObj);
const pos = consumer.originalPositionFor({ line: 1234, column: 56 });
console.log(pos); // { source, line, column, name }
consumer.destroy();
}
lookup();

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1131373

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX