第一种方式
如果您使用的是世博会。你应该使用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>"
}
}
]
}
}
-
organization
你可以在这里找到https://sentry.io/settings/ https://sentry.io/settings/其中名为“组织名称”
-
project
输入您的项目名称,您可以在这里找到:https://sentry.io/organizations/ORGANIZATION_NAME/projects/ https://sentry.io/organizations/ORGANIZATION_NAME/projects/
-
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.
但是:无法查看 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'