代码之家  ›  专栏  ›  技术社区  ›  John doe

Sentry找不到我的源代码

  •  3
  • John doe  · 技术社区  · 7 年前

    我无法在sentry仪表板中显示我的原始代码。

    我发现以下错误

    Discarded invalid parameter 'type'

    Source code was not found for app:///crna-entry.delta? 
    platform=ios&dev=true&minify=false`
    

    我已配置 app.json 如文件所示。

    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "xxxxx",
            "project": "xxxxxxx",
            "authToken": "xxxxxxxxxx"
          }
        }
      ]
    }
    
    0 回复  |  直到 7 年前
        1
  •  0
  •   Fatih Turgut    7 年前

    我回答了这个问题 here

    第一条路

    如果您正在使用expo。您应该使用 sentry-expo 您可以在此处找到的软件包: sentry-expo

    把这个钩子挂在你的 expo json(app.json) 文件

    {
      "expo": {
        "hooks": {
          "postPublish": [
            {
              "file": "sentry-expo/upload-sourcemaps",
              "config": {
                "organization": "<your organization name>",
                "project": "<your project name>",
                "authToken": "<your auth token here>"
              }
            }
          ]
        }
    }
    
    
    1. organization 你可以在这里找到 https://sentry.io/settings/ 名称为“组织名称”
    2. project 输入项目名称,您可以在此处找到: https://sentry.io/organizations/ORGANIZATION_NAME/projects/
    3. authToken 使用此url创建authToken https://sentry.io/api/

    然后运行 expo publish ,它会自动上载源地图。

    本地测试

    确保启用了世博会开发。 添加行;

    Sentry.enableInExpoDevelopment = true;
    Sentry.config(publicDsn, options).install();
    

    因此

    在岗哨上, 仅适用于ios ,您可以看到发生错误的源代码。 enter image description here

    但是:无法查看ANDROID的源代码

    https://github.com/getsentry/react-native-sentry/issues/372

    第二种方式(手动上传)

    使用api https://docs.sentry.io/platforms/javascript/sourcemaps/

    curl -X POST \
      https://sentry.io/api/0/organizations/ORG_NAME/releases/VERSION/files/ \
      -H 'Authorization: Bearer AUTH_TOKEN' \
      -H 'content-type: multipart/form-data' \
      -F file=@script.min.js.map \
      -F 'name=~/scripts/script.min.js.map'
    
    推荐文章