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

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

本文介绍了如何手动将我的源代码上传到哨兵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My app is built with expo and sentry dashboard shows me 2 errors :

因此,当我收到错误消息时,就无法调试,因为我只有一个丑陋的内置js.

So when i receive errors, it's impossible to debug because i only have an uglyfied built js.

有什么方法可以手动上传源EXPO源代码.我应该发送哪个文件给哨兵?

Is there any way to upload the source expo source code manually. Which file should i send to sentry?

谢谢

推荐答案

第一种方式

如果您正在使用expo.您应该使用sentry-expo软件包,可以在这里找到: sentry-expo

First way

If you are using expo. You should use sentry-expo package which you can find here: 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/
  1. organization you can find on here https://sentry.io/settings/ which named "Organization Name"
  2. project enter your project name, you can find here: https://sentry.io/organizations/ORGANIZATION_NAME/projects/
  3. authToken create a authToken with this url https://sentry.io/api/

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

Then run expo publish, it upload the source maps automatically.

本地测试

确保已启用expo开发.添加行;

Make sure that you enabled expo development.add lines;

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

结果

在哨兵上,仅适用于iOS ,您可以查看发生错误的源代码.

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

但是:无法查看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 [email protected] \
  -F 'name=~/scripts/script.min.js.map'

这篇关于如何手动将我的源代码上传到哨兵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 11:47