V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
SHEN22
V2EX  ›  程序员

求助 sentry 配置 i 问题

  •  
  •   SHEN22 · 35 天前 · 846 次点击
    这是一个创建于 35 天前的主题,其中的信息可能已经有所发展或是发生改变。
    {
        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 但是报错的时候不显示具体的报错行数是怎么回事

    3 条回复    2025-05-14 10:05:45 +08:00
    zzjjhh001
        1
    zzjjhh001  
       34 天前
    能确定线上静态资源的访问路径,和 urlPrefix 配置的路径一致么?
    有的静态资源都喜欢加点前缀啥的
    SHEN22
        2
    SHEN22  
    OP
       34 天前
    @zzjjhh001 http://xxx.com/assets/* 通过这样访问我是能访问到资源的 应该就没问题吧
    zzjjhh001
        3
    zzjjhh001  
       34 天前
    是的,可以本地试下生成的 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();
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5086 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 06:54 · PVG 14:54 · LAX 23:54 · JFK 02:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.