Skip to content

Commit b16f221

Browse files
committed
fix(bundle): upload Sentry sourcemaps with Debug ID
1 parent c0d80f9 commit b16f221

11 files changed

Lines changed: 440 additions & 687 deletions

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ export PUSHY_REGISTRY=https://your-api-endpoint.com
134134
export NO_INTERACTIVE=true
135135
```
136136

137+
## Sentry Sourcemaps
138+
139+
When `ios/sentry.properties` or `android/sentry.properties` exists, `bundle` uploads sourcemaps for OTA packages. The default matching path is Sentry Debug IDs; the CLI no longer infers release/dist from the native package.
140+
141+
React Native projects should use `@sentry/react-native/metro` in `metro.config.js` so the generated bundle and sourcemap share the same Debug ID. For Hermes, the CLI copies the packager sourcemap Debug ID to the composed Hermes sourcemap and uploads with:
142+
143+
```bash
144+
sentry-cli sourcemaps upload --debug-id-reference
145+
```
146+
147+
For older self-hosted Sentry versions or older `@sentry/cli` versions without Debug ID support, pass explicit legacy release/dist values:
148+
149+
```bash
150+
npx pushy bundle --platform android --name "4.1" --sentry-release "com.example@1.0.0+10+pushy:4.1" --sentry-dist "pushy:4.1"
151+
```
152+
153+
In legacy mode, the app runtime must report exactly the same Sentry `release` and `dist` values.
154+
137155
## Configuration
138156

139157
Create `update.json` in your React Native project:

README.zh-CN.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ export PUSHY_REGISTRY=https://your-api-endpoint.com
134134
export NO_INTERACTIVE=true
135135
```
136136

137+
## Sentry Sourcemap
138+
139+
当项目存在 `ios/sentry.properties``android/sentry.properties` 时,`bundle` 会为 OTA 包上传 sourcemap。默认使用 Sentry Debug ID 匹配,不再根据原生包推导 release/dist。
140+
141+
React Native 项目需要在 `metro.config.js` 中接入 `@sentry/react-native/metro`,确保生成的 bundle 和 sourcemap 带有相同 Debug ID。Hermes 场景下 CLI 会把 packager sourcemap 的 Debug ID 复制到合成后的 Hermes sourcemap,并使用:
142+
143+
```bash
144+
sentry-cli sourcemaps upload --debug-id-reference
145+
```
146+
147+
旧版 self-hosted Sentry 或旧版 `@sentry/cli` 不支持 Debug ID 时,可以显式指定 legacy release/dist:
148+
149+
```bash
150+
npx pushy bundle --platform android --name "4.1" --sentry-release "com.example@1.0.0+10+pushy:4.1" --sentry-dist "pushy:4.1"
151+
```
152+
153+
这种 legacy 模式要求 App 运行时上报到 Sentry 的 `release``dist` 与上传参数完全一致。
154+
137155
## 配置文件
138156

139157
在 React Native 项目中创建 `update.json`

cli.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,6 @@
313313
"sentryDist": {
314314
"hasValue": true,
315315
"description": "Sentry dist for source map upload"
316-
},
317-
"sentry-flavor": {
318-
"hasValue": true,
319-
"description": "Android product flavor or variant for native Sentry release/dist"
320-
},
321-
"sentryFlavor": {
322-
"hasValue": true,
323-
"description": "Android product flavor or variant for native Sentry release/dist"
324316
}
325317
}
326318
},

0 commit comments

Comments
 (0)