如何手动上传我的源代码到哨兵?

2024-01-09

我的应用程序是用 expo 构建的,哨兵仪表板显示了 2 个错误:

丢弃无效参数“类型”

and

找不到 app:///crna-entry.bundle 的源代码? 平台=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2FUser%2FDesktop%2Fpath%2Fto%2Fnode_modules%2Fexp。

因此,当我收到错误时,无法进行调试,因为我只有一个丑陋的内置 js。

有没有办法手动上传source expo源代码。我应该发送哪个文件给哨兵?

Thanks


第一种方式

如果您使用的是世博会。你应该使用sentry-expo您可以在这里找到包:哨兵博览会 https://stackoverflow.com/a/56162218/5263696

把这个钩子挂到你的世博 json (app.json) file

{
  "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/ https://sentry.io/settings/其中名为“组织名称”
  2. project输入您的项目名称,您可以在这里找到:https://sentry.io/organizations/ORGANIZATION_NAME/projects/ https://sentry.io/organizations/ORGANIZATION_NAME/projects/
  3. authToken使用此 url 创建 authTokenhttps://sentry.io/api/ https://sentry.io/api/

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

本地测试

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

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

因此

On sentry, for only ios, you can able to see the source code where error occured. enter image description here

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

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

第二种方式(手动上传)

使用 APIhttps://docs.sentry.io/platforms/javascript/sourcemaps/ 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 fi[email protected] /cdn-cgi/l/email-protection \
  -F 'name=~/scripts/script.min.js.map'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何手动上传我的源代码到哨兵? 的相关文章

随机推荐