Skip to content

Commit f870f2d

Browse files
Merge eb3a867 into 940bd65
2 parents 940bd65 + eb3a867 commit f870f2d

File tree

183 files changed

+1700
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+1700
-802
lines changed

CHANGELOG.md

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,69 @@
22

33
<!-- prettier-ignore-start -->
44
> [!IMPORTANT]
5-
> If you are upgrading to the `6.x` versions of the Sentry React Native SDK from `5.x` or below,
5+
> If you are upgrading to the `7.x` versions of the Sentry React Native SDK from `6.x` or below,
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9+
## 7.0.0-beta.0
10+
11+
### Upgrading from 6.x to 7.0
12+
13+
Version 7 of the Sentry React Native SDK primarily introduces API cleanup and version support changes based on the Sentry Javascript SDK version 9. This update contains behavioral changes that will not be caught by type checkers, linters, or tests, so we recommend carefully reading through the entire migration guide instead of relying on automatic tooling.
14+
15+
Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or higher (unchanged from v6). Lower versions may continue to work, but may not support all features.
16+
17+
### Major Changes
18+
19+
- Set `{{auto}}` if `user.ip_address` is `undefined` and `sendDefaultPii: true` ([#4466](https://github.com/getsentry/sentry-react-native/pull/4466))
20+
- `Sentry.captureUserFeedback` removed, use `Sentry.captureFeedback` instead ([#4855](https://github.com/getsentry/sentry-react-native/pull/4855))
21+
22+
### Major Changes from Sentry JS SDK v9
23+
24+
- Exceptions from `captureConsoleIntegration` are now marked as handled: true by default
25+
- `shutdownTimeout` moved from `core` to `@sentry/react-native`
26+
- `hasTracingEnabled` was renamed to `hasSpansEnabled`
27+
- You can no longer drop spans or return null on `beforeSendSpan` hook
28+
- Fork `scope` if custom scope is passed to `startSpanManual` or `startSpan`
29+
30+
#### Removed types
31+
32+
- TransactionNamingScheme
33+
- Request
34+
- Scope (prefer using the Scope class)
35+
36+
#### Other removed items.
37+
38+
- `autoSessionTracking` from options.
39+
To enable session tracking, ensure that `enableAutoSessionTracking` is enabled.
40+
- `enableTracing`. Instead, set `tracesSampleRate` to a value greater than `zero` to `enable tracing`, `0` to keep tracing integrations active without sampling, or `undefined` to disable the performance integration.
41+
- `getCurrentHub()`, `Hub`, and `getCurrentHubShim()`
42+
- `spanId` from propagation `context`
43+
- metrics API
44+
- `transactionContext` from `samplingContext`
45+
- `@sentry/utils` package, the exports were moved to `@sentry/core`
46+
- Standalone `Client` interface & deprecate `BaseClient`
47+
48+
### Changes
49+
50+
- Use `Replay` interface for `browserReplayIntegration` return type ([#4858](https://github.com/getsentry/sentry-react-native/pull/4858))
51+
- Allow using `browserReplayIntegration` without `isWeb` guard ([#4858](https://github.com/getsentry/sentry-react-native/pull/4858))
52+
- The integration returns noop in non-browser environments
53+
- Use single `encodeUTF8` implementation through the SDK ([#4885](https://github.com/getsentry/sentry-react-native/pull/4885))
54+
- Use global `TextEncoder` (available with Hermes in React Native 0.74 or higher) to improve envelope encoding performance. ([#4874](https://github.com/getsentry/sentry-react-native/pull/4874))
55+
- `breadcrumbsIntegration` disables React Native incompatible options automatically ([#4886](https://github.com/getsentry/sentry-react-native/pull/4886))
56+
- On React Native Web, `browserSessionIntegration` is added when `enableAutoSessionTracking` is set to `True` ([#4732](https://github.com/getsentry/sentry-react-native/pull/4732))
57+
- Change `Cold/Warm App Start` span description to `Cold/Warm Start` ([#4636](https://github.com/getsentry/sentry-react-native/pull/4636))
58+
59+
### Dependencies
60+
61+
- Bump JavaScript SDK from v8.54.0 to v9.22.0 ([#4568](https://github.com/getsentry/sentry-react-native/pull/4568), [#4752](https://github.com/getsentry/sentry-react-native/pull/4752), [#4860](https://github.com/getsentry/sentry-react-native/pull/4860))
62+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/9.22.0/CHANGELOG.md)
63+
- [diff](https://github.com/getsentry/sentry-javascript/compare/8.54.0...9.22.0)
64+
- Bump Android SDK from v7.20.1 to v8.13.2 ([#4490](https://github.com/getsentry/sentry-react-native/pull/4490), [#4847](https://github.com/getsentry/sentry-react-native/pull/4847))
65+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8132)
66+
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.13.2)
67+
968
## 6.15.0
1069

1170
### Features
@@ -57,6 +116,71 @@
57116
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2460)
58117
- [diff](https://github.com/getsentry/sentry-cli/compare/2.45.0...2.46.0)
59118

119+
## 7.0.0-alpha.0
120+
121+
### Upgrading from 6.x to 7.0
122+
123+
Version 7 of the Sentry React Native SDK primarily introduces API cleanup and version support changes based on the Sentry Javascript SDK version 9. This update contains behavioral changes that will not be caught by type checkers, linters, or tests, so we recommend carefully reading through the entire migration guide instead of relying on automatic tooling.
124+
125+
Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or higher (unchanged from v6). Lower versions may continue to work, but may not support all features.
126+
127+
### Fixes
128+
129+
- Expo Updates Context is passed to native after native init to be available for crashes ([#4808](https://github.com/getsentry/sentry-react-native/pull/4808))
130+
- Expo Updates Context values should all be lowercase ([#4809](https://github.com/getsentry/sentry-react-native/pull/4809))
131+
- Avoid duplicate network requests (fetch, xhr) by default ([#4816](https://github.com/getsentry/sentry-react-native/pull/4816))
132+
- `traceFetch` is disabled by default on mobile as RN uses a polyfill which will be traced by `traceXHR`
133+
134+
### Major Changes
135+
136+
- Set `{{auto}}` if `user.ip_address` is `undefined` and `sendDefaultPii: true` ([#4466](https://github.com/getsentry/sentry-react-native/pull/4466))
137+
- Exceptions from `captureConsoleIntegration` are now marked as handled: true by default
138+
- `shutdownTimeout` moved from `core` to `@sentry/react-native`
139+
- `hasTracingEnabled` was renamed to `hasSpansEnabled`
140+
- You can no longer drop spans or return null on `beforeSendSpan` hook
141+
142+
### Removed types
143+
144+
- TransactionNamingScheme
145+
- Request
146+
- Scope (prefer using the Scope class)
147+
148+
### Other removed items.
149+
150+
- `autoSessionTracking` from options.
151+
To enable session tracking, ensure that `enableAutoSessionTracking` is enabled.
152+
- `enableTracing`. Instead, set `tracesSampleRate` to a value greater than `zero` to `enable tracing`, `0` to keep tracing integrations active without sampling, or `undefined` to disable the performance integration.
153+
- `getCurrentHub()`, `Hub`, and `getCurrentHubShim()`
154+
- `spanId` from propagation `context`
155+
- metrics API
156+
- `transactionContext` from `samplingContext`
157+
- `@sentry/utils` package, the exports were moved to `@sentry/core`
158+
- Standalone `Client` interface & deprecate `BaseClient`
159+
160+
### Other Changes
161+
162+
- Fork `scope` if custom scope is passed to `startSpanManual` or `startSpan`
163+
- On React Native Web, `browserSessionIntegration` is added when `enableAutoSessionTracking` is set to `True` ([#4732](https://github.com/getsentry/sentry-react-native/pull/4732))
164+
- Change `Cold/Warm App Start` span description to `Cold/Warm Start` ([#4636](https://github.com/getsentry/sentry-react-native/pull/4636))
165+
166+
### Dependencies
167+
168+
- Bump JavaScript SDK from v8.54.0 to v9.12.0 ([#4568](https://github.com/getsentry/sentry-react-native/pull/4568), [#4752](https://github.com/getsentry/sentry-react-native/pull/4752))
169+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/9.12.0/CHANGELOG.md)
170+
- [diff](https://github.com/getsentry/sentry-javascript/compare/8.54.0...9.12.0)
171+
- Bump Android SDK from v7.20.1 to v8.11.1 ([#4490](https://github.com/getsentry/sentry-react-native/pull/4490))
172+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8111)
173+
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.11.1)
174+
- Bump CLI from v2.43.1 to v2.45.0 ([#4804](https://github.com/getsentry/sentry-react-native/pull/4804), [#4818](https://github.com/getsentry/sentry-react-native/pull/4818))
175+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2450)
176+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.43.1...2.45.0)
177+
- Bump Bundler Plugins from v3.3.1 to v3.4.0 ([#4805](https://github.com/getsentry/sentry-react-native/pull/4805))
178+
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#340)
179+
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.3.1...3.4.0)
180+
- Bump Cocoa SDK from v8.49.2 to v8.50.0 ([#4807](https://github.com/getsentry/sentry-react-native/pull/4807))
181+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8500)
182+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.49.2...8.50.0)
183+
60184
## 6.14.0
61185

62186
### Fixes

dev-packages/e2e-tests/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-e2e-tests",
3-
"version": "6.15.0",
3+
"version": "7.0.0-beta.0",
44
"private": true,
55
"description": "Sentry React Native End to End Tests Library",
66
"main": "dist/index.js",
@@ -13,8 +13,8 @@
1313
"devDependencies": {
1414
"@babel/preset-env": "^7.25.3",
1515
"@babel/preset-typescript": "^7.18.6",
16-
"@sentry/core": "8.54.0",
17-
"@sentry/react-native": "6.15.0",
16+
"@sentry/core": "9.22.0",
17+
"@sentry/react-native": "7.0.0-beta.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",
2020
"appium": "2.4.1",

dev-packages/type-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sentry-react-native-type-check",
33
"private": true,
4-
"version": "6.15.0",
4+
"version": "7.0.0-beta.0",
55
"scripts": {
66
"type-check": "./run-type-check.sh"
77
}

dev-packages/type-check/ts3.8-test/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ declare global {
33
interface IDBObjectStore {}
44
interface Window {
55
fetch: any;
6+
setTimeout: any;
7+
document: any;
68
}
79
interface ShadowRoot {}
810
interface BufferSource {}
@@ -19,6 +21,8 @@ declare global {
1921
redirectCount: number;
2022
}
2123
interface PerformanceEntry {}
24+
interface Performance {}
25+
interface PerformanceNavigationTiming {}
2226
}
2327

2428
declare module 'react-native' {

dev-packages/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-samples-utils",
3-
"version": "6.15.0",
3+
"version": "7.0.0-beta.0",
44
"description": "Internal Samples Utils",
55
"main": "index.js",
66
"license": "MIT",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "6.15.0",
3+
"version": "7.0.0-beta.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
'@typescript-eslint/no-empty-function': 'off',
3939
'@typescript-eslint/no-explicit-any': 'off',
4040
'@typescript-eslint/unbound-method': 'off',
41+
'import/first': 'off',
4142
},
4243
},
4344
{

packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ final class RNSentryReplayOptions: XCTestCase {
167167
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0)
168168
}
169169

170-
func testEnableViewRendererV2Default() {
170+
func testEnableExperimentalViewRendererDefault() {
171171
let optionsDict = ([
172172
"dsn": "https://abc@def.ingest.sentry.io/1234567",
173173
"replaysOnErrorSampleRate": 0.75
@@ -177,10 +177,10 @@ final class RNSentryReplayOptions: XCTestCase {
177177

178178
let actualOptions = try! Options(dict: optionsDict as! [String: Any])
179179

180-
XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
180+
XCTAssertTrue(actualOptions.sessionReplay.enableExperimentalViewRenderer)
181181
}
182182

183-
func testEnableViewRendererV2True() {
183+
func testEnableExperimentalViewRendererTrue() {
184184
let optionsDict = ([
185185
"dsn": "https://abc@def.ingest.sentry.io/1234567",
186186
"replaysOnErrorSampleRate": 0.75,
@@ -194,7 +194,7 @@ final class RNSentryReplayOptions: XCTestCase {
194194
XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
195195
}
196196

197-
func testEnableViewRendererV2False() {
197+
func testEnableExperimentalViewRendererFalse() {
198198
let optionsDict = ([
199199
"dsn": "https://abc@def.ingest.sentry.io/1234567",
200200
"replaysOnErrorSampleRate": 0.75,

packages/core/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ android {
5454

5555
dependencies {
5656
implementation 'com.facebook.react:react-native:+'
57-
api 'io.sentry:sentry-android:7.22.5'
57+
api 'io.sentry:sentry-android:8.13.2'
5858
}

packages/core/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
import com.facebook.react.bridge.WritableNativeMap;
3232
import com.facebook.react.common.JavascriptException;
3333
import io.sentry.Breadcrumb;
34-
import io.sentry.HubAdapter;
3534
import io.sentry.ILogger;
3635
import io.sentry.IScope;
3736
import io.sentry.ISentryExecutorService;
3837
import io.sentry.ISerializer;
3938
import io.sentry.Integration;
39+
import io.sentry.ScopesAdapter;
4040
import io.sentry.Sentry;
4141
import io.sentry.SentryDate;
4242
import io.sentry.SentryDateProvider;
@@ -88,6 +88,7 @@
8888
import java.util.List;
8989
import java.util.Map;
9090
import java.util.Properties;
91+
import java.util.Set;
9192
import java.util.concurrent.CountDownLatch;
9293
import org.jetbrains.annotations.NotNull;
9394
import org.jetbrains.annotations.Nullable;
@@ -528,7 +529,7 @@ public void fetchNativeFrames(Promise promise) {
528529
}
529530

530531
public void captureReplay(boolean isHardCrash, Promise promise) {
531-
Sentry.getCurrentHub().getOptions().getReplayController().captureReplay(isHardCrash);
532+
Sentry.getCurrentScopes().getOptions().getReplayController().captureReplay(isHardCrash);
532533
promise.resolve(getCurrentReplayId());
533534
}
534535

@@ -624,7 +625,7 @@ public void fetchViewHierarchy(Promise promise) {
624625
return;
625626
}
626627

627-
ISerializer serializer = HubAdapter.getInstance().getOptions().getSerializer();
628+
ISerializer serializer = ScopesAdapter.getInstance().getOptions().getSerializer();
628629
final @Nullable byte[] bytes =
629630
JsonSerializationUtils.bytesFrom(serializer, logger, viewHierarchy);
630631
if (bytes == null) {
@@ -678,10 +679,6 @@ public void setUser(final ReadableMap userKeys, final ReadableMap userDataKeys)
678679
if (userKeys.hasKey("ip_address")) {
679680
userInstance.setIpAddress(userKeys.getString("ip_address"));
680681
}
681-
682-
if (userKeys.hasKey("segment")) {
683-
userInstance.setSegment(userKeys.getString("segment"));
684-
}
685682
}
686683

687684
if (userDataKeys != null) {
@@ -843,8 +840,7 @@ private void initializeAndroidProfiler() {
843840
(int) SECONDS.toMicros(1) / profilingTracesHz,
844841
new SentryFrameMetricsCollector(reactApplicationContext, logger, buildInfo),
845842
executorService,
846-
logger,
847-
buildInfo);
843+
logger);
848844
}
849845

850846
public WritableMap startProfiling(boolean platformProfilers) {
@@ -868,7 +864,7 @@ public WritableMap startProfiling(boolean platformProfilers) {
868864
}
869865

870866
public WritableMap stopProfiling() {
871-
final boolean isDebug = HubAdapter.getInstance().getOptions().isDebug();
867+
final boolean isDebug = ScopesAdapter.getInstance().getOptions().isDebug();
872868
final WritableMap result = new WritableNativeMap();
873869
File output = null;
874870
try {
@@ -954,7 +950,7 @@ private String readStringFromFile(File path) throws IOException {
954950
}
955951

956952
public void fetchNativeDeviceContexts(Promise promise) {
957-
final @NotNull SentryOptions options = HubAdapter.getInstance().getOptions();
953+
final @NotNull SentryOptions options = ScopesAdapter.getInstance().getOptions();
958954
final @Nullable Context context = this.getReactApplicationContext().getApplicationContext();
959955
final @Nullable IScope currentScope = InternalSentrySdk.getCurrentScope();
960956
fetchNativeDeviceContexts(promise, options, context, currentScope);
@@ -991,7 +987,8 @@ protected void fetchNativeDeviceContexts(
991987
}
992988

993989
public void fetchNativeSdkInfo(Promise promise) {
994-
final @Nullable SdkVersion sdkVersion = HubAdapter.getInstance().getOptions().getSdkVersion();
990+
final @Nullable SdkVersion sdkVersion =
991+
ScopesAdapter.getInstance().getOptions().getSdkVersion();
995992
if (sdkVersion == null) {
996993
promise.resolve(null);
997994
} else {
@@ -1079,14 +1076,14 @@ private void addPackages(SentryEvent event, SdkVersion sdk) {
10791076
if (eventSdk != null
10801077
&& "sentry.javascript.react-native".equals(eventSdk.getName())
10811078
&& sdk != null) {
1082-
List<SentryPackage> sentryPackages = sdk.getPackages();
1079+
Set<SentryPackage> sentryPackages = sdk.getPackageSet();
10831080
if (sentryPackages != null) {
10841081
for (SentryPackage sentryPackage : sentryPackages) {
10851082
eventSdk.addPackage(sentryPackage.getName(), sentryPackage.getVersion());
10861083
}
10871084
}
10881085

1089-
List<String> integrations = sdk.getIntegrations();
1086+
Set<String> integrations = sdk.getIntegrationSet();
10901087
if (integrations != null) {
10911088
for (String integration : integrations) {
10921089
eventSdk.addIntegration(integration);

packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class RNSentryVersion {
44
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "6.15.0";
5+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "7.0.0-beta.0";
66
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
77
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
88
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";

packages/core/ios/RNSentryVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
44
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
55
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
6-
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.15.0";
6+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"7.0.0-beta.0";

0 commit comments

Comments
 (0)