我回答了这个问题
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>"
}
}
]
}
}
-
organization
你可以在这里找到
https://sentry.io/settings/
名称为“组织名称”
-
project
输入项目名称,您可以在此处找到:
https://sentry.io/organizations/ORGANIZATION_NAME/projects/
-
authToken
使用此url创建authToken
https://sentry.io/api/
然后运行
expo publish
,它会自动上载源地图。
本地测试
确保启用了世博会开发。
添加行;
Sentry.enableInExpoDevelopment = true;
Sentry.config(publicDsn, options).install();
因此
在岗哨上,
仅适用于ios
,您可以看到发生错误的源代码。
但是:无法查看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'