【问题标题】:Sentry cannot find my source codeSentry 找不到我的源代码
【发布时间】:2019-01-28 11:59:29
【问题描述】:

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

我收到以下错误

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"
      }
    }
  ]
}

【问题讨论】:

    标签: expo sentry react-native-sentry


    【解决方案1】:

    我回答了这个问题here

    第一种方式

    如果您使用的是世博会。你应该使用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 https://sentry.io/api/ 创建一个 authToken

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

    本地测试

    确保您启用了 expo 开发。 添加行;

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

    结果

    在哨兵上,仅适用于ios,您可以看到发生错误的源代码。

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

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

    第二种方式(手动上传)

    使用apihttps://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'
    

    【讨论】:

      猜你喜欢
      • 2012-06-15
      • 1970-01-01
      • 2020-01-15
      • 2014-04-07
      • 2015-05-27
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多