@bugsee/react-native 7.0.0-beta2 → 7.0.0-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -9
- package/android/build.gradle +9 -0
- package/android/consumer-rules.pro +3 -0
- package/android/src/main/java/com/bugsee/reactnative/BreadcrumbFilterBridge.java +224 -20
- package/android/src/main/java/com/bugsee/reactnative/BugseeModule.java +44 -21
- package/android/src/main/java/com/bugsee/reactnative/BugseeOptionEnums.java +15 -0
- package/android/src/main/java/com/bugsee/reactnative/LogFilterBridge.java +119 -5
- package/android/src/main/java/com/bugsee/reactnative/NetworkCaptureProbe.java +107 -0
- package/android/src/main/java/com/bugsee/reactnative/NetworkFilterBridge.java +129 -14
- package/android/src/main/java/com/bugsee/reactnative/ReactNativeWrapperInitProvider.java +48 -0
- package/android/src/main/java/com/bugsee/reactnative/SpanHandles.java +64 -8
- package/android/src/main/java/com/bugsee/reactnative/StartupHold.java +237 -0
- package/ios/BugseeModule.mm +293 -155
- package/ios/Support/Package.resolved +2 -2
- package/ios/Support/Package.swift +1 -1
- package/ios/Support/Sources/BugseeRNSupport/BGSRNBlackout.m +14 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNDeleteCollectedData.m +33 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNFilterArming.m +22 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNFilterDeadline.m +110 -0
- package/ios/Support/Sources/BugseeRNSupport/BGSRNSpanHandles.m +40 -6
- package/ios/Support/Sources/BugseeRNSupport/BGSRNWrapper.m +1 -1
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNBlackout.h +23 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNCreatedReportOps.h +2 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNDeleteCollectedData.h +29 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNFilterArming.h +26 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNFilterDeadline.h +68 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportHandlerBridge.h +5 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNReportOps.h +5 -0
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNSpanHandles.h +16 -2
- package/ios/Support/Sources/BugseeRNSupport/include/BGSRNWrapperChannelHolder.h +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNBlackoutTests.m +38 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNDeleteCollectedDataTests.m +135 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFakeReport.h +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFilterArmingTests.m +48 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNFilterDeadlineTests.m +230 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNReportHandlerBridgeTests.m +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNSpanHandlesTests.m +86 -6
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperChannelHolderTests.m +5 -0
- package/ios/Support/Tests/BugseeRNSupportTests/BGSRNWrapperTests.m +1 -1
- package/native-versions.json +2 -2
- package/package.json +2 -2
- package/plugin/build/dsym-script.d.ts +11 -0
- package/plugin/build/dsym-script.js +26 -3
- package/plugin/build/dsym-script.js.map +1 -1
- package/plugin/build/index.d.ts +27 -0
- package/plugin/build/index.js +33 -21
- package/plugin/build/index.js.map +1 -1
- package/plugin/build/manifest.d.ts +37 -0
- package/plugin/build/manifest.js +67 -1
- package/plugin/build/manifest.js.map +1 -1
- package/plugin/build/native-versions.baked.json +1 -1
- package/scripts/bugsee-xcode.sh +0 -0
- package/scripts/compose-then-inject.js +4 -2
- package/scripts/hermes-sourcemaps.js +40 -3
- package/scripts/hermesc-preserve-js.js +0 -0
- package/scripts/hermesc-preserve-js.sh +0 -0
- package/src/NativeBugsee.ts +39 -22
- package/src/apm/span.ts +42 -7
- package/src/breadcrumbs/filter.ts +104 -13
- package/src/breadcrumbs/types.ts +6 -4
- package/src/breadcrumbs/url-scrub.ts +75 -0
- package/src/exceptions/ErrorBoundary.tsx +4 -1
- package/src/exceptions/RootErrorReporter.tsx +1 -1
- package/src/exceptions/handlers.ts +17 -1
- package/src/exceptions/report.ts +30 -8
- package/src/index.ts +125 -33
- package/src/logs/filter.ts +19 -8
- package/src/network/filter.ts +17 -5
- package/src/options/AndroidLaunchOptions.ts +310 -24
- package/src/options/BugseeLaunchOptions.ts +463 -18
- package/src/options/IOSLaunchOptions.ts +164 -8
- package/src/options/android-options-manifest.json +63 -6
- package/src/options/enums.ts +28 -0
- package/src/options/ios-enums.json +6 -5
- package/src/options/ios-options-manifest.json +594 -0
- package/src/options/keys.ts +19 -1
- package/src/options/noAccessor.ts +16 -0
- package/src/options/option-keys.json +9 -3
- package/src/options/unknownKeys.ts +198 -0
package/README.md
CHANGED
|
@@ -9,8 +9,7 @@ added.
|
|
|
9
9
|
|
|
10
10
|
## Status: beta
|
|
11
11
|
|
|
12
|
-
This is a beta (`7.0.0-
|
|
13
|
-
bundles is itself a beta. `latest` and `beta` both point at it for now, so a plain
|
|
12
|
+
This is a beta (`7.0.0-beta4`), built on the 7.x native SDKs (Android 7.6.0, iOS 7.1.0). `latest` and `beta` both point at it for now, so a plain
|
|
14
13
|
`yarn add @bugsee/react-native` installs it; the `@beta` form in [Install](#install)
|
|
15
14
|
keeps following betas once a stable release exists. The API can still change
|
|
16
15
|
between betas.
|
|
@@ -51,9 +50,15 @@ Manager. Earlier versions use CocoaPods, where the podspec vendors the same
|
|
|
51
50
|
XCFramework — run `pod install` as usual. Nothing is published to CocoaPods
|
|
52
51
|
trunk, so no `pod repo update` is needed.
|
|
53
52
|
|
|
54
|
-
**Android.**
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
**Android.** Requires the Bugsee Gradle plugin for network capture and Release
|
|
54
|
+
symbolication. Autolinking picks the module up, and the app builds and
|
|
55
|
+
launches with no Gradle changes, but without the Bugsee Gradle plugin it records
|
|
56
|
+
**no network events** from JS `fetch`/XHR (the plugin injects Bugsee's OkHttp
|
|
57
|
+
interceptor into React Native's networking), and Release symbolication needs
|
|
58
|
+
that plugin and the source-map hooks too. A bare app that skips the plugin logs
|
|
59
|
+
one warning at launch, tagged `BugseeRN`. See
|
|
60
|
+
[Android: Bugsee Gradle plugin](#android-bugsee-gradle-plugin) and
|
|
61
|
+
[Release symbolication](#release-symbolication).
|
|
57
62
|
|
|
58
63
|
**pnpm 10 and later** run no dependency's install script unless the project
|
|
59
64
|
decides, and pnpm 11 fails the install until it does
|
|
@@ -89,6 +94,90 @@ running, or a token the backend rejects — without that being an error worth
|
|
|
89
94
|
throwing on. Capture comes up asynchronously, so poll `getStatus()` rather
|
|
90
95
|
than assuming a resolved `launch` means recording has begun.
|
|
91
96
|
|
|
97
|
+
### Launch options
|
|
98
|
+
|
|
99
|
+
Every option either native SDK accepts has a typed accessor on the options object, shared ones on both
|
|
100
|
+
platforms and platform-only ones on the Android or iOS object. Nothing is defaulted by the wrapper: an
|
|
101
|
+
option you leave unset takes the SDK's own default.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const options = createDefaultLaunchOptions();
|
|
105
|
+
options.triggerByShake = true; // shake-to-report is OFF by default (iOS 7.1.0, Android 7.6.0)
|
|
106
|
+
options.triggerByScreenshot = false;
|
|
107
|
+
options.reportingUIEmailRequired = true;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- **Wrong keys are not silent.** The Android SDK drops a key it does not know and the iOS SDK ignores it, so a
|
|
111
|
+
6.x name such as `ShakeToReport` (which iOS still maps) would otherwise do nothing on Android. `launch` and
|
|
112
|
+
`relaunch` log one `console.warn` per unknown key and name the key to use.
|
|
113
|
+
- **`launch` while the SDK is already running ignores the options** you pass: an iOS session that is
|
|
114
|
+
already up, or an Android process the SDK relaunched itself after the OS killed it. Check `getStatus()` first.
|
|
115
|
+
- **`relaunch(options)` restarts with exactly the options you pass.** Options you omit return to the SDK
|
|
116
|
+
default; the previous launch's are not kept.
|
|
117
|
+
|
|
118
|
+
The full list, with keys, types and platforms, is in
|
|
119
|
+
[`docs/launch-options.md`](https://github.com/bugsee/bugsee-react-native/blob/main/docs/launch-options.md).
|
|
120
|
+
|
|
121
|
+
### Reporting render errors
|
|
122
|
+
|
|
123
|
+
Wrap part of the tree (or the whole app) in `<ErrorBoundary>` to report an error thrown while rendering
|
|
124
|
+
and show a fallback instead of an empty screen:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { ErrorBoundary } from '@bugsee/react-native';
|
|
128
|
+
|
|
129
|
+
<ErrorBoundary
|
|
130
|
+
fallback={({ error, componentStack, resetError }) => (
|
|
131
|
+
<ErrorScreen onRetry={resetError} />
|
|
132
|
+
)}
|
|
133
|
+
onError={(error, componentStack) => console.warn('render failed', error)}
|
|
134
|
+
options={{ domain: 'checkout' }}
|
|
135
|
+
>
|
|
136
|
+
<App />
|
|
137
|
+
</ErrorBoundary>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| Prop | |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `fallback` | What to render after an error: an element, or a function that receives `error`, `componentStack` and `resetError()`. Without it the boundary renders nothing, so give it one. |
|
|
143
|
+
| `onError(error, componentStack)` | Called after the boundary has caught the error, and after it has reported it unless the error was already reported (see the list below). |
|
|
144
|
+
| `onReset(error, componentStack)` | Called when `resetError()` is called, just before the children render again. |
|
|
145
|
+
| `options` | Handled-exception options for the report. `{ domain }` only, as for `Bugsee.logException`. An invalid value logs a warning and the error is reported without options. |
|
|
146
|
+
|
|
147
|
+
What it does and does not do:
|
|
148
|
+
|
|
149
|
+
- The error is reported as a **handled** exception, with the React component stack attached as an extra
|
|
150
|
+
(not as the error's `cause`).
|
|
151
|
+
- An error object the SDK has already reported is not reported again, so a boundary and
|
|
152
|
+
`Bugsee.logException` (or the global handler) do not file the same error twice, unless it later ends the app as a crash. Deduplication applies to
|
|
153
|
+
error objects only: a thrown string or number is never deduplicated.
|
|
154
|
+
- When `com.bugsee.option.detect.crash` is `false` the boundary reports nothing, as the global handlers
|
|
155
|
+
do; it still shows the fallback and calls `onError`. (`Bugsee.logException` is an explicit call and
|
|
156
|
+
always reports.)
|
|
157
|
+
- `children` is a plain React node. The function-as-children form from 6.x is not supported.
|
|
158
|
+
- Like any React error boundary it only catches errors thrown while **rendering**. Errors in event
|
|
159
|
+
handlers, timers and promises are not caught by it; the global handlers `launch` installs report the
|
|
160
|
+
uncaught ones.
|
|
161
|
+
|
|
162
|
+
### Exception capture: what to know
|
|
163
|
+
|
|
164
|
+
- **Render errors need `Bugsee.wrap`.** On React Native 0.81+ an uncaught render error never reaches
|
|
165
|
+
`ErrorUtils`, so it is reported as a crash only when the app root is wrapped:
|
|
166
|
+
`AppRegistry.registerComponent(name, () => Bugsee.wrap(App))`. An error boundary above the app
|
|
167
|
+
that swallows the error hides it from Bugsee; put an `<ErrorBoundary>` below it, or call
|
|
168
|
+
`Bugsee.logException` from your own boundary.
|
|
169
|
+
- **Log, then rethrow.** Deduplication is per error object and per kind. `Bugsee.logException(e)`
|
|
170
|
+
followed by a rethrow that ends the app is still reported as a crash, and
|
|
171
|
+
`Bugsee.logUnhandledException(e)` after `logException(e)` is reported. Once an error has been
|
|
172
|
+
reported as a crash, no later report of it is sent. A report dropped because the SDK had not
|
|
173
|
+
launched yet still counts as sent.
|
|
174
|
+
- **Unhandled promise rejections** are reported as handled errors, not crashes. Hermes has no getter
|
|
175
|
+
for the active rejection tracker, so if another library installs one after `launch()`, the last
|
|
176
|
+
one installed wins and Bugsee stops seeing rejections. Likewise Bugsee replaces any tracker installed
|
|
177
|
+
before `launch()`, and chains only React Native's own dev-mode options.
|
|
178
|
+
- **iOS Simulator.** The Simulator slice of the iOS SDK has no crash reporter, and
|
|
179
|
+
`logUnhandledException` does nothing there. Exercise crash capture on a device.
|
|
180
|
+
|
|
92
181
|
### Hiding a view from recordings
|
|
93
182
|
|
|
94
183
|
Wrap anything that must never be recorded in `<BugseeSecure>`:
|
|
@@ -179,6 +268,10 @@ Known limits:
|
|
|
179
268
|
hooks and the iOS dSYM Archive action. Release builds then upload their source
|
|
180
269
|
maps, and Archives upload their dSYMs, whenever a real token is set.
|
|
181
270
|
`uploadSourcemaps: false` and `uploadSymbols: false` turn those uploads off.
|
|
271
|
+
`editGradleFiles: false` stops the plugin editing the three Android Gradle
|
|
272
|
+
files, for a project whose files are Kotlin DSL (see "refuses" below). Edits
|
|
273
|
+
an earlier prebuild made stay, and later changes to `uploadSymbols`,
|
|
274
|
+
`nativeCrashReporting` or `gradlePluginVersion` no longer reach those files.
|
|
182
275
|
A committed `ios/` (`project.pbxproj` and the shared scheme) or
|
|
183
276
|
`android/bugsee.properties` carries the token.
|
|
184
277
|
|
|
@@ -215,6 +308,60 @@ on Bugsee's production API. Set, it reaches every upload and the runtime:
|
|
|
215
308
|
Each of these is the plugin's own, so a later prebuild with a new value
|
|
216
309
|
replaces it, and one without `endpoint` removes it again.
|
|
217
310
|
|
|
311
|
+
### Auto-launch: what is recorded before JavaScript runs (Android)
|
|
312
|
+
|
|
313
|
+
With `autoLaunch` the Android SDK starts at process start, from manifest
|
|
314
|
+
meta-data, before any JavaScript exists. Two things follow:
|
|
315
|
+
|
|
316
|
+
- **Reports say which wrapper they came from, with context.** The native side
|
|
317
|
+
registers only the wrapper type and version at process start; `Bugsee.attach()`
|
|
318
|
+
registers the rest (React Native version, JS engine, build configuration), as
|
|
319
|
+
`launch()` and `relaunch()` do. Call `attach()` once at startup.
|
|
320
|
+
- **Filters are not installed yet.** The JS log, network and breadcrumb filters
|
|
321
|
+
are installed natively only when `setLogFilter`, `setNetworkFilter` and
|
|
322
|
+
`setBreadcrumbFilter` run, so what the SDK captures before then is recorded
|
|
323
|
+
unfiltered. To close that window, opt in per filter:
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
["@bugsee/react-native", { "autoLaunch": true, "appToken": "<token>", "holdFilters": ["network", "log", "breadcrumb"] }]
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`true` holds all three. A held filter is installed natively at process start
|
|
330
|
+
and drops every event of its kind (log lines, network events, breadcrumbs)
|
|
331
|
+
until JS calls its setter, with a function (your filter applies) or with
|
|
332
|
+
`null` (no filter: events pass through). Call each setter unconditionally,
|
|
333
|
+
early, on every start of the JS runtime. Only list the filters your app
|
|
334
|
+
installs: an app that lists one and never calls its setter records none of
|
|
335
|
+
that kind, and the wrapper says so in the log (`BugseeRN`, warning) 30 s after
|
|
336
|
+
process start. It is off by default for that reason, and an app that never uses
|
|
337
|
+
filters is unaffected. It writes `com.bugsee.reactnative.hold-filters`
|
|
338
|
+
application meta-data, removed again by a prebuild without the option.
|
|
339
|
+
A JS reload is held only if the previous runtime had a filter function
|
|
340
|
+
installed (it stays dropped until the new runtime calls the setter again). If
|
|
341
|
+
the previous runtime called `setXFilter(null)`, that kind passes through again
|
|
342
|
+
from the reload until the new runtime calls the setter. The 30 s warning is
|
|
343
|
+
given once per process, at 30 s after process start. The hold is meant
|
|
344
|
+
for `autoLaunch`; it was not
|
|
345
|
+
verified with a JS `launch()`, where the SDK may replace a filter set before
|
|
346
|
+
launch. In a process that never starts React Native (a service or push
|
|
347
|
+
process), a held kind drops everything native code records, for the life of
|
|
348
|
+
that process.
|
|
349
|
+
Two interactions to know about: a filter you declare in the manifest
|
|
350
|
+
(`com.bugsee.filter.log-event`, `network-event` or `breadcrumb`) is not
|
|
351
|
+
applied for a kind that is held, because the SDK lets a filter set from code
|
|
352
|
+
take its place, so do not list a kind you filter from the manifest; and
|
|
353
|
+
`setXFilter(null)` then leaves that kind with no filter at all.
|
|
354
|
+
For `breadcrumb`, `setBreadcrumbUrlScrubber` arms the hold like
|
|
355
|
+
`setBreadcrumbFilter` does: `true` or a function counts as installing the
|
|
356
|
+
filter. Turning the scrubber off while it was never on does nothing, but
|
|
357
|
+
turning it off while it was on, with no breadcrumb filter set, releases the
|
|
358
|
+
hold, so crumbs pass through unfiltered until a setter runs again.
|
|
359
|
+
- **Masking is not held.** Nothing from `<BugseeSecure>` or `setSecureRectangles`
|
|
360
|
+
is masked until those mount, and the wrapper cannot hold the SDK's capture
|
|
361
|
+
from JS-side state. If the first frames must not show a sensitive screen, do
|
|
362
|
+
not auto-launch: call `Bugsee.launch()` from JavaScript (or keep `autoLaunch`
|
|
363
|
+
off), after your first secure view is in place.
|
|
364
|
+
|
|
218
365
|
The plugin's Gradle edits never remove or change a line of your own code, on a
|
|
219
366
|
clean or a `--no-clean` prebuild, however often it runs: it adds its own
|
|
220
367
|
marked lines, replaces only those, and rewrites exactly one of yours,
|
|
@@ -233,7 +380,9 @@ with certainty it refuses the prebuild with one error that names the file,
|
|
|
233
380
|
the reason and the fix, and writes nothing. It refuses:
|
|
234
381
|
|
|
235
382
|
- a Kotlin DSL `settings.gradle.kts`, `build.gradle.kts` or app
|
|
236
|
-
`build.gradle.kts
|
|
383
|
+
`build.gradle.kts` (make the edits by hand, then set
|
|
384
|
+
`"editGradleFiles": false` in the plugin options and prebuild again: the
|
|
385
|
+
plugin then leaves all three Gradle files alone);
|
|
237
386
|
- a Gradle file it cannot read for sure: a string that does not close on its
|
|
238
387
|
line, a comment or string still open at the end of the file, braces that do
|
|
239
388
|
not balance, or a `/` that could start a slashy string as well as divide;
|
|
@@ -253,6 +402,77 @@ so when the root file already has one the pin goes into it (its braces must
|
|
|
253
402
|
stand alone on their lines, or the prebuild refuses); a new block is written
|
|
254
403
|
only when there is none.
|
|
255
404
|
|
|
405
|
+
## Network privacy
|
|
406
|
+
|
|
407
|
+
`Bugsee.setNetworkFilter` sees network events, and only network events.
|
|
408
|
+
Write it as if it were your only redaction.
|
|
409
|
+
|
|
410
|
+
- **Built-in redaction differs by platform.** On Android this package runs the
|
|
411
|
+
built-in sanitizer on each event before your filter (when
|
|
412
|
+
`com.bugsee.option.capture.network.default-sanitizer` is on). On iOS your
|
|
413
|
+
filter replaces the built-in sanitizer, so raw events reach it and anything
|
|
414
|
+
it does not remove is recorded. The built-in rules differ too. iOS matches a
|
|
415
|
+
fixed set of header names plus fixed query and body keys, and does not strip
|
|
416
|
+
credentials from URLs. Android also matches substrings such as `password`,
|
|
417
|
+
`secret`, `token`, `session` and `apikey` in header, query and body keys,
|
|
418
|
+
strips `user:password` from URLs and redacts error messages.
|
|
419
|
+
- **The filter does not reach every place a URL is recorded:**
|
|
420
|
+
- **HTTP breadcrumbs** (only when `captureBreadcrumbs` is enabled; type
|
|
421
|
+
`http`, the URL is `data.url`). Native records the URL before any JS
|
|
422
|
+
filter runs: Android records it unredacted, without even the built-in
|
|
423
|
+
query redaction, and iOS applies the built-in query redaction when
|
|
424
|
+
`default-sanitizer` is on. `setNetworkFilter` never sees them. This
|
|
425
|
+
package can clean them, **off by default**:
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
Bugsee.setBreadcrumbUrlScrubber(true);
|
|
429
|
+
// or your own: (url: string) => string
|
|
430
|
+
Bugsee.setBreadcrumbUrlScrubber(url => url.replace(/\/users\/\d+/, '/users/:id'));
|
|
431
|
+
// off again
|
|
432
|
+
Bugsee.setBreadcrumbUrlScrubber(false);
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
`true` drops `user:password@`, the query string and the fragment, and
|
|
436
|
+
keeps the scheme, host, port and path. An `@` after a `?` with a `:` before it (`u:pa?ss@host`) cannot be told
|
|
437
|
+
from a port with an `@` in its query, so everything after `https://` becomes `[redacted]`. Path segments can still carry an
|
|
438
|
+
identifier or a token, and a `;jsessionid=...` path parameter stays: use a
|
|
439
|
+
custom scrubber for those. The scrubber
|
|
440
|
+
runs before the callback of `setBreadcrumbFilter`, which then sees the
|
|
441
|
+
cleaned URL. It applies to every crumb of type `http` with a string
|
|
442
|
+
`data.url`, including one you pass to `addBreadcrumb`. A scrubber that
|
|
443
|
+
throws or returns a non-string drops the crumb, never records the
|
|
444
|
+
original.
|
|
445
|
+
|
|
446
|
+
It is opt-in because of what it costs. Native asks JS about every
|
|
447
|
+
breadcrumb, not only `http` ones, while a breadcrumb filter or the
|
|
448
|
+
scrubber is installed, so turning it on adds that round trip (and the 9 s
|
|
449
|
+
deadline, fail-closed) to each crumb. With it off, and no breadcrumb
|
|
450
|
+
filter, nothing is asked and nothing is paid. It is a per-runtime setting
|
|
451
|
+
like `setBreadcrumbFilter`: call it on every launch of the JS runtime,
|
|
452
|
+
because after a reload native drops crumbs until it is called again. A
|
|
453
|
+
`setBreadcrumbFilter(null)` does not turn it off. Crumbs the SDK records
|
|
454
|
+
before JS runs the setter (an Android auto-launch) are not scrubbed; the
|
|
455
|
+
`holdFilters` option below closes that window. Only `data.url` is
|
|
456
|
+
cleaned: the SDKs' own `http` crumbs carry the URL nowhere else.
|
|
457
|
+
- **`http.client` performance spans** (performance monitoring,
|
|
458
|
+
`com.bugsee.option.performance.enabled`, is on by default). Android always
|
|
459
|
+
applies its built-in sanitizer to span URLs, even with `default-sanitizer`
|
|
460
|
+
off. iOS applies no sanitization to span URLs. To turn them off:
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
const options = createDefaultLaunchOptions();
|
|
464
|
+
options.setCustomOption('com.bugsee.option.performance.enabled', false);
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
- **`detect.http-errors` reports** (off by default) carry the request URL in
|
|
468
|
+
`http_url` without its query or fragment. Path segments are not passed
|
|
469
|
+
through your filter.
|
|
470
|
+
|
|
471
|
+
Routing span URLs through the network filter, and running the built-in
|
|
472
|
+
sanitizer ahead of the filter on iOS, needs changes in the native SDKs, which
|
|
473
|
+
are tracked there. This package's side is tracked in
|
|
474
|
+
[#137](https://github.com/bugsee/bugsee-react-native/issues/137).
|
|
475
|
+
|
|
256
476
|
## Release symbolication
|
|
257
477
|
|
|
258
478
|
A Release build has to send Bugsee what turns its crash frames back into
|
|
@@ -287,6 +507,25 @@ react {
|
|
|
287
507
|
apply from: new File(new File(bugseeDir, "scripts"), "bugsee-sourcemaps.gradle")
|
|
288
508
|
```
|
|
289
509
|
|
|
510
|
+
In a Kotlin DSL `android/app/build.gradle.kts` the same two edits read as
|
|
511
|
+
follows (not run by the test suite; check them against your Gradle version):
|
|
512
|
+
|
|
513
|
+
```kotlin
|
|
514
|
+
val bugseeDir = File(
|
|
515
|
+
ProcessBuilder("node", "--print", "require.resolve('@bugsee/react-native/package.json')")
|
|
516
|
+
.directory(rootDir).start().inputStream.bufferedReader().readText().trim()
|
|
517
|
+
).parentFile
|
|
518
|
+
|
|
519
|
+
react {
|
|
520
|
+
hermesCommand.set(
|
|
521
|
+
File(File(bugseeDir, "scripts"), if (System.getProperty("os.name").startsWith("Windows")) "hermesc-preserve-js.cmd" else "hermesc-preserve-js.sh").absolutePath
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// At the end of the file.
|
|
526
|
+
apply(from = File(File(bugseeDir, "scripts"), "bugsee-sourcemaps.gradle"))
|
|
527
|
+
```
|
|
528
|
+
|
|
290
529
|
The OS is checked when Gradle configures the build, so one `build.gradle`
|
|
291
530
|
works on macOS, Linux and Windows. Both launchers run
|
|
292
531
|
`scripts/hermesc-preserve-js.js` with `node`, which must be on the `PATH` (as
|
|
@@ -328,9 +567,16 @@ bundle and Metro's map get the id instead.
|
|
|
328
567
|
|
|
329
568
|
## Android: Bugsee Gradle plugin
|
|
330
569
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
570
|
+
Required on Android for **network capture**: it injects Bugsee's OkHttp
|
|
571
|
+
interceptor into every `OkHttpClient.Builder.build()` call outside
|
|
572
|
+
`com.bugsee.*`, `okhttp3.*` and your own excludes, which includes React Native's
|
|
573
|
+
`fetch`/XHR. Without it the app runs but records no JS network events; the
|
|
574
|
+
wrapper logs a `BugseeRN` warning at launch when the interceptor is missing,
|
|
575
|
+
which also happens if the plugin's OkHttp instrumentation is disabled or
|
|
576
|
+
excluded.
|
|
577
|
+
It also uploads the R8/ProGuard mapping, the native (NDK) symbols and the build
|
|
578
|
+
info of each Release build. It is a Gradle plugin, so autolinking cannot add
|
|
579
|
+
it; the config plugin writes these same edits for an Expo app.
|
|
334
580
|
|
|
335
581
|
`android/settings.gradle` — the plugin is published to Maven Central, which
|
|
336
582
|
Gradle does not search for plugins unless told to:
|
|
@@ -444,6 +690,15 @@ in the build environment (for example `export BUGSEE_APP_TOKEN=…` in
|
|
|
444
690
|
skipped the upload; `BUGSEE_UPLOAD_SOURCEMAPS=false` turns the upload off,
|
|
445
691
|
and a failed upload warns without failing the build. Debug builds skip it.
|
|
446
692
|
|
|
693
|
+
`.xcode.env` and `.xcode.env.local` are read for the token by the Archive
|
|
694
|
+
dSYM post-action as well, so a token exported there also reaches Xcode GUI
|
|
695
|
+
Archives.
|
|
696
|
+
|
|
697
|
+
Source maps are uploaded with `sourcesContent`, the source code of your app,
|
|
698
|
+
so the dashboard can show it. `BUGSEE_STRIP_SOURCES_CONTENT=true` in the
|
|
699
|
+
build environment (iOS and Android) removes it from the uploaded copy; the
|
|
700
|
+
map on disk is not touched, and symbolication still works.
|
|
701
|
+
|
|
447
702
|
Native iOS frames come from the dSYMs. The config plugin adds an Archive
|
|
448
703
|
post-action that uploads them with `bugsee-cli xcode post-action`; a bare app
|
|
449
704
|
adds the same post-action to its scheme's Archive action (the example app's
|
package/android/build.gradle
CHANGED
|
@@ -148,6 +148,15 @@ dependencies {
|
|
|
148
148
|
// a JS fetch would otherwise never reach a bundle. `api`, like the core
|
|
149
149
|
// SDK: the interceptor class has to be in the app, not only this module.
|
|
150
150
|
api "com.bugsee:bugsee-android-okhttp:${nativeVersions.android.sdk}"
|
|
151
|
+
// The launch-time probe (NetworkCaptureProbe) compiles against okhttp. In an
|
|
152
|
+
// app, react-android exposes it as `api` at the version that RN release
|
|
153
|
+
// pins, and a version of our own would clash with that (Gradle's
|
|
154
|
+
// consistent resolution rejected 4.12.0 against RN 0.86's 4.9.2). The
|
|
155
|
+
// standalone unit-test build has no react-android, so it names one.
|
|
156
|
+
if (standalone) {
|
|
157
|
+
compileOnly 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
158
|
+
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
159
|
+
}
|
|
151
160
|
// For @Nullable/@NonNull. The SDK exposes these types in its own public
|
|
152
161
|
// API, so a consumer has androidx.annotation on the classpath regardless.
|
|
153
162
|
implementation 'androidx.annotation:annotation:1.9.1'
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
# The Bugsee backend routes React Native exceptions on this class name.
|
|
2
2
|
-keepnames class com.bugsee.reactnative.ReactNativeWebException
|
|
3
|
+
|
|
4
|
+
# The launch-time probe matches the plugin-injected interceptor by class name.
|
|
5
|
+
-keepnames class com.bugsee.library.okhttp.BugseeOkHttpInterceptor
|