• 请不要在回答技术问题时复制粘贴 AI 生成的内容
SHEN22
V2EX  ›  程序员

求助 sentry 配置 i 问题

  •  
  •   SHEN22 · May 13, 2025 · 1511 views
    This topic created in 410 days ago, the information mentioned may be changed or developed.
    {
        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 replies    2025-05-14 10:05:45 +08:00
    zzjjhh001
        1
    zzjjhh001  
       May 13, 2025
    能确定线上静态资源的访问路径,和 urlPrefix 配置的路径一致么?
    有的静态资源都喜欢加点前缀啥的
    SHEN22
        2
    SHEN22  
    OP
       May 14, 2025
    @zzjjhh001 http://xxx.com/assets/* 通过这样访问我是能访问到资源的 应该就没问题吧
    zzjjhh001
        3
    zzjjhh001  
       May 14, 2025
    是的,可以本地试下生成的 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();
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   973 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 18:59 · PVG 02:59 · LAX 11:59 · JFK 14:59
    ♥ Do have faith in what you're doing.