我似乎想不通这件事。有没有人能帮我解决这个问题?我正在使用CodePush上传我的应用程序,我希望前哨来处理我的错误,因为应用程序中心的诊断不是很好。
我在我的应用程序的根组件中有这个...
if (process.env.NODE_ENV === 'production') {
Sentry.config('****',{
deactivateStacktraceMerging: false
}).install();
codePush.getUpdateMetadata().then((update) => {
if (update) {
Sentry.setVersion(update.appVersion + '-codepush:' + update.label);
}
});
}我有一个部署包脚本,它将部署到codepush,并运行在他们的文档中找到的哨兵命令
appcenter codepush release-react -a account/project --output-dir ./build && export SENTRY_PROPERTIES=./ios/sentry.properties && sentry-cli react-native appcenter account/project ios ./build/codePush
每次我捕获到一个错误或我捕获到的错误时,我缺乏关于哪个文件抛出错误的实际信息,当我展开它时,我在顶部看到There was 1 error encountered while processing this event,它显示Source code was not found for app:///main.jsbundle。
我觉得这一定是因为sentry没有正确连接到codepush来获取我的源码地图?
发布于 2021-06-29 18:56:04
经过一些试验和失败(因为前哨文档具有误导性),最终使用AppCenter代码推送获得了适用于iOS和安卓的源地图,遵循了bash脚本中的以下步骤:
MY_APP_NAME="e.g. Sentry account/project"
MY_BUNDLE_ID="e.g. com.company.superapp"
MY_APP_ENV="e.g. development, staging or production"
NATIVE_VERSION="e.g. 1.2.3"
PLATFORM="e.g. ios or android"
# Build and release to appcenter
appcenter codepush release-react \
-a "$MY_APP_NAME" \
-d "$MY_APP_ENV" \
-m -t "$NATIVE_VERSION" \
--sourcemap-output \
--output-dir "./build/$PLATFORM"
export SENTRY_PROPERTIES="./$PLATFORM/sentry.properties"
# Get label and name of latest release
LABEL=$(appcenter codepush deployment history $MY_APP_ENV -a $MY_APP_NAME --output json | jq '.[-1][0]' -r)
RELEASE_NAME="$MY_BUNDLE_ID@$NATIVE_VERSION+codepush:$LABEL"
# Upload sourcemap
sentry-cli react-native appcenter \
"$MY_APP_NAME" "$PLATFORM" "./build/$PLATFORM/CodePush" \
--deployment "$MY_APP_ENV" \
--release-name "$RELEASE_NAME" \
--dist "$LABEL"并在app.ts (或类似的)中执行此初始化:
Sentry.init({...});
codePush.getUpdateMetadata().then(update => {
if (update) {
if (MY_APP_ENV === 'production')) {
Sentry.setRelease(
`${MY_BUNDLE_ID}@${update.appVersion}+codepush:${update.label}`,
);
} else {
Sentry.setRelease(
`${MY_BUNDLE_ID}.${MY_APP_ENV}@${update.appVersion}+codepush:${update.label}`,
);
}
Sentry.setDist(update.label);
}
});环境:
appcenter version: 2.7.3
@sentry/react-native: 2.5.1发布于 2020-06-02 19:20:55
我正在处理相同的堆栈和捆绑包,并且正在上传sentry,但我有两个问题:
sentry-cli react-native appcenter YourApp ios ./build/CodePush --dist YourBuildNumber。
这里面的YourBuildNumber是什么,是应用程序版本,还是一些哨兵版本,代码版本标签还是其他什么?

发布于 2020-10-29 04:49:15
当您通过命令行界面上传源地图时,您需要使用release和dist选项调用Sentry.init,并传递与标志相同的值。
如果你想和CodePush一起使用
,你必须把release和dist传递给Sentry.init。我们的建议是将它们存储在app.json中,或者您可以直接使用package.json。这些值对于代码库的每个版本都需要是唯一的,并且与源映射上的版本完全匹配,否则它们可能不会被符号化。
例如:
Sentry.init({
dsn: YOUR_DSN,
release: '1.0',
dist: 'v1',
});然后当你想上传源地图时:
export SENTRY_PROPERTIES=./ios/sentry.properties
sentry-cli react-native appcenter \
account/project \
ios ./build/codePush \
--release-name "1.0" \
--dist "v1"您的release和dist可以是任意字符串,但Sentry建议使用以下格式:
${BUNDLE_ID}@${APP_VERSION}+codepush:${DIST}
https://stackoverflow.com/questions/53616302
复制相似问题