Skip to content

Commit e8692e1

Browse files
Merge branch 'main' into fixCompileError
2 parents 3bd36b1 + a8caa5e commit e8692e1

7 files changed

Lines changed: 124 additions & 44 deletions

File tree

CHANGELOG.md

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,31 @@
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9+
## Unreleased
10+
11+
### Important Changes
12+
13+
This release includes a fix for a [behaviour change](https://docs.sentry.io/platforms/javascript/migration/v8-to-v9/#behavior-changes)
14+
that was originally fixed on version 6.21.0 of the React Native SDK: User IP Addresses should only be added to Sentry events automatically,
15+
if `sendDefaultPii` was set to `true`.
16+
17+
To avoid making a major bump, the fix was patched on the current version and not by bumping to V8.
18+
There is _no API_ breakage involved and hence it is safe to update.
19+
However, after updating the SDK, events (errors, traces, replays, etc.) sent from the browser, will only include
20+
user IP addresses, if you set `sendDefaultPii: true` in your `Sentry.init` options.
21+
22+
We apologize for any inconvenience caused!
23+
24+
## Fixes
25+
26+
- Ensure IP address is only inferred by Relay if `sendDefaultPii` is `true` ([#5138](https://github.com/getsentry/sentry-react-native/pull/5137))
27+
28+
### Dependencies
29+
30+
- Bump Bundler Plugins from v4.2.0 to v4.3.0 ([#5131](https://github.com/getsentry/sentry-react-native/pull/5131))
31+
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#430)
32+
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/4.2.0...4.3.0)
33+
934
## 7.0.0
1035

1136
### Upgrading from 6.x to 7.0
@@ -14,6 +39,8 @@ Version 7 of the Sentry React Native SDK primarily introduces API cleanup and ve
1439

1540
Version 7 of the SDK is compatible with Sentry self-hosted versions 25.2.0 or higher (up from 24.4.2 for v6). Lower versions may continue to work, but may not support all features.
1641

42+
See our [migration docs](https://docs.sentry.io/platforms/react-native/migration/v6-to-v7/) for more information.
43+
1744
### Major Changes
1845

1946
- Ensure IP address is only inferred by Relay if `sendDefaultPii` is `true` ([#5111](https://github.com/getsentry/sentry-react-native/pull/5111))
@@ -91,7 +118,7 @@ Sentry.init({
91118

92119
### Fixes
93120

94-
- Align span description with other platforms (#4636) by @krystofwoldrich
121+
- Align span description with other platforms ([#4636](https://github.com/getsentry/sentry-react-native/pull/4636)) by @krystofwoldrich
95122
- Tags with symbol are now logged ([#4965](https://github.com/getsentry/sentry-react-native/pull/4965))
96123
- IgnoreError now filters Native errors ([#4948](https://github.com/getsentry/sentry-react-native/pull/4948))
97124

@@ -115,12 +142,16 @@ example:
115142

116143
### Dependencies
117144

118-
- Bump JavaScript SDK from v8.54.0 to v10.8.0 ([#5123](https://github.com/getsentry/sentry-react-native/pull5123))
145+
- Bump JavaScript SDK v10.8.0 ([#5123](https://github.com/getsentry/sentry-react-native/pull/5123))
119146
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#1080)
120-
- [diff](https://github.com/getsentry/sentry-javascript/compare/8.54.0...10.8.0)
121-
- Bump Android SDK from v7.20.1 to v8.20.0 ([#5106](https://github.com/getsentry/sentry-react-native/pull/5106))
147+
- Bump Android SDK to v8.20.0 ([#5106](https://github.com/getsentry/sentry-react-native/pull/5106))
122148
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8200)
123-
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.20.0)
149+
- Bump CLI to v2.53.0 ([5120](https://github.com/getsentry/sentry-react-native/pull/5120). [#4804](https://github.com/getsentry/sentry-react-native/pull/4804), [#4818](https://github.com/getsentry/sentry-react-native/pull/4818))
150+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2530)
151+
- Bump Bundler Plugins to v4.2.0 ([#5113](https://github.com/getsentry/sentry-react-native/pull/5113), [#4805](https://github.com/getsentry/sentry-react-native/pull/4805))
152+
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#340)
153+
- Bump Cocoa SDK to v8.53.2 ([#4986](https://github.com/getsentry/sentry-react-native/pull/4986))
154+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8532)
124155

125156
## 7.0.0-rc.2
126157

@@ -152,8 +183,20 @@ We apologize for any inconvenience caused!
152183

153184
### Various fixes & improvements
154185

155-
- fix(sdk): Set `{{auto}}` if `user.ip_address` is `undefined` and `sendDefaultPii: true` (#4466) by @krystofwoldrich
156-
- fix(appStart): Align span description with other platforms (#4636) by @krystofwoldrich
186+
- fix(sdk): Set `{{auto}}` if `user.ip_address` is `undefined` and `sendDefaultPii: true` ([#4466](https://github.com/getsentry/sentry-react-native/pull/4466)) by @krystofwoldrich
187+
- fix(appStart): Align span description with other platforms ([#4636](https://github.com/getsentry/sentry-react-native/pull/4636)) by @krystofwoldrich
188+
189+
### Dependencies
190+
191+
- Bump Cocoa SDK from v8.53.1 to v8.53.2 ([#4986](https://github.com/getsentry/sentry-react-native/pull/4986))
192+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8532)
193+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.53.1...8.53.2)
194+
- Bump CLI from v2.47.0 to v2.50.2 ([#5007](https://github.com/getsentry/sentry-react-native/pull/5007))
195+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2502)
196+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.47.0...2.50.2)
197+
- Bump Bundler Plugins from v3.5.0 to v4.0.2 ([#5030](https://github.com/getsentry/sentry-react-native/pull/5030))
198+
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#402)
199+
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.5.0...4.0.2)
157200

158201
## 7.0.0-beta.2
159202

@@ -197,6 +240,12 @@ example:
197240
- Bump Android SDK from v8.14.0 to v8.17.0 ([#4953](https://github.com/getsentry/sentry-react-native/pull/4953), [#4955](https://github.com/getsentry/sentry-react-native/pull/4955), [#4987](https://github.com/getsentry/sentry-react-native/pull/4987))
198241
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8170)
199242
- [diff](https://github.com/getsentry/sentry-java/compare/8.14.0...8.17.0)
243+
- Bump Cocoa SDK from v8.52.1 to v8.53.1 ([#4950](https://github.com/getsentry/sentry-react-native/pull/4950))
244+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8531)
245+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.52.1...8.53.1)
246+
- Bump CLI from v2.46.0 to v2.47.0 ([#4979](https://github.com/getsentry/sentry-react-native/pull/4979))
247+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2470)
248+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.46.0...2.47.0)
200249

201250
## 7.0.0-beta.1
202251

@@ -281,6 +330,9 @@ Sentry.init({
281330
- Bump Android SDK from v8.13.2 to v8.14.0 ([#4929](https://github.com/getsentry/sentry-react-native/pull/4929), [#4934](https://github.com/getsentry/sentry-react-native/pull/4934))
282331
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8140)
283332
- [diff](https://github.com/getsentry/sentry-java/compare/8.13.2...8.14.0)
333+
- Bump Cocoa SDK from v8.52.0 to v8.52.1 ([#4899](https://github.com/getsentry/sentry-react-native/pull/4899))
334+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8521)
335+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.52.0...8.52.1)
284336

285337
## 7.0.0-beta.0
286338

@@ -340,6 +392,15 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
340392
- 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))
341393
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8132)
342394
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.13.2)
395+
- Bump Cocoa SDK from v8.50.0 to v8.52.0 ([#4887](https://github.com/getsentry/sentry-react-native/pull/4887))
396+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8520)
397+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.50.0...8.52.0)
398+
- Bump CLI from v2.43.0 to v2.46.0 ([#4866]([???](https://github.com/getsentry/sentry-react-native/pull/4866)))
399+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2460)
400+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.43.0...2.46.0)
401+
- Bump Bundler Plugins from v3.4.0 to v3.5.0 ([#4850](https://github.com/getsentry/sentry-react-native/pull/4850))
402+
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#350)
403+
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.4.0...3.5.0)
343404

344405
## 7.0.0-alpha.0
345406

@@ -396,9 +457,6 @@ Version 7 of the SDK is compatible with Sentry self-hosted versions 24.4.2 or hi
396457
- Bump Android SDK from v7.20.1 to v8.11.1 ([#4490](https://github.com/getsentry/sentry-react-native/pull/4490))
397458
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#8111)
398459
- [diff](https://github.com/getsentry/sentry-java/compare/7.20.1...8.11.1)
399-
- 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))
400-
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2450)
401-
- [diff](https://github.com/getsentry/sentry-cli/compare/2.43.1...2.45.0)
402460
- Bump Bundler Plugins from v3.3.1 to v3.4.0 ([#4805](https://github.com/getsentry/sentry-react-native/pull/4805))
403461
- [changelog](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/CHANGELOG.md#340)
404462
- [diff](https://github.com/getsentry/sentry-javascript-bundler-plugins/compare/3.3.1...3.4.0)

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"react-native": ">=0.65.0"
6868
},
6969
"dependencies": {
70-
"@sentry/babel-plugin-component-annotate": "4.2.0",
70+
"@sentry/babel-plugin-component-annotate": "4.3.0",
7171
"@sentry/browser": "10.8.0",
7272
"@sentry/cli": "2.53.0",
7373
"@sentry/core": "10.8.0",
@@ -82,7 +82,7 @@
8282
"@sentry-internal/eslint-config-sdk": "10.8.0",
8383
"@sentry-internal/eslint-plugin-sdk": "10.8.0",
8484
"@sentry-internal/typescript": "10.8.0",
85-
"@sentry/wizard": "6.3.0",
85+
"@sentry/wizard": "6.4.0",
8686
"@testing-library/react-native": "^12.7.2",
8787
"@types/jest": "^29.5.13",
8888
"@types/node": "^20.9.3",

packages/core/src/js/client.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
import {
1414
_INTERNAL_flushLogsBuffer,
1515
addAutoIpAddressToSession,
16-
addAutoIpAddressToUser,
1716
Client,
1817
dateTimestampInSeconds,
1918
debug,
@@ -52,6 +51,15 @@ export class ReactNativeClient extends Client<ReactNativeClientOptions> {
5251
ignoreRequireCycleLogs(ReactNativeLibraries.ReactNativeVersion?.version);
5352
options._metadata = options._metadata || {};
5453
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
54+
55+
// Only allow IP inferral by Relay if sendDefaultPii is true
56+
if (options._metadata?.sdk) {
57+
options._metadata.sdk.settings = {
58+
infer_ip: options.sendDefaultPii ? 'auto' : 'never',
59+
...options._metadata.sdk.settings,
60+
};
61+
}
62+
5563
// We default this to true, as it is the safer scenario
5664
options.parentSpanIsAlwaysRootSpan =
5765
options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;
@@ -60,7 +68,6 @@ export class ReactNativeClient extends Client<ReactNativeClientOptions> {
6068
this._outcomesBuffer = [];
6169

6270
if (options.sendDefaultPii === true) {
63-
this.on('postprocessEvent', addAutoIpAddressToUser);
6471
this.on('beforeSendSession', addAutoIpAddressToSession);
6572
}
6673

packages/core/test/client.test.ts

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -687,25 +687,42 @@ describe('Tests ReactNativeClient', () => {
687687
});
688688

689689
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user).toEqual(
690-
expect.objectContaining({ ip_address: '{{auto}}' }),
690+
expect.objectContaining({ ip_address: undefined }),
691+
);
692+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].sdk).toEqual(
693+
expect.objectContaining({
694+
settings: {
695+
infer_ip: 'never',
696+
},
697+
}),
691698
);
692699
});
693700

694-
test('adds ip_address {{auto}} to user if not set', () => {
701+
test('adds ip_address undefined to user if not set', () => {
695702
client.captureEvent({
696703
user: {},
697704
});
698705

699-
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user).toEqual(
700-
expect.objectContaining({ ip_address: '{{auto}}' }),
706+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user).toBeEmptyObject();
707+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].sdk).toEqual(
708+
expect.objectContaining({
709+
settings: {
710+
infer_ip: 'never',
711+
},
712+
}),
701713
);
702714
});
703715

704-
test('adds ip_address {{auto}} to undefined user', () => {
716+
test('leaves ip_address undefined to undefined user', () => {
705717
client.captureEvent({});
706718

707-
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user).toEqual(
708-
expect.objectContaining({ ip_address: '{{auto}}' }),
719+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user).toBeUndefined();
720+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].sdk).toEqual(
721+
expect.objectContaining({
722+
settings: {
723+
infer_ip: 'never',
724+
},
725+
}),
709726
);
710727
});
711728

@@ -724,15 +741,13 @@ describe('Tests ReactNativeClient', () => {
724741
expect(
725742
mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].user?.ip_address,
726743
).toBeUndefined();
727-
});
728-
729-
test('uses ip address hooks if sendDefaultPii is true', () => {
730-
const { onSpy } = createClientWithSpy({
731-
sendDefaultPii: true,
732-
});
733-
734-
expect(onSpy).toHaveBeenCalledWith('postprocessEvent', addAutoIpAddressToUser);
735-
expect(onSpy).toHaveBeenCalledWith('beforeSendSession', addAutoIpAddressToSession);
744+
expect(mockTransportSend.mock.calls[0][firstArg][envelopeItems][0][envelopeItemPayload].sdk).toEqual(
745+
expect.objectContaining({
746+
settings: {
747+
infer_ip: 'never',
748+
},
749+
}),
750+
);
736751
});
737752

738753
test('does not add ip_address {{auto}} to session if sendDefaultPii is false', () => {

samples/expo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"devDependencies": {
4444
"@babel/core": "^7.26.0",
4545
"@babel/preset-env": "^7.26.0",
46-
"@sentry/babel-plugin-component-annotate": "4.2.0",
46+
"@sentry/babel-plugin-component-annotate": "4.3.0",
4747
"@types/node": "20.10.4",
4848
"sentry-react-native-samples-utils": "workspace:^"
4949
},

samples/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@react-native/eslint-config": "0.77.1",
5656
"@react-native/metro-config": "0.77.1",
5757
"@react-native/typescript-config": "0.77.1",
58-
"@sentry/babel-plugin-component-annotate": "4.2.0",
58+
"@sentry/babel-plugin-component-annotate": "4.3.0",
5959
"@testing-library/react-native": "^13.2.2",
6060
"@types/jest": "^29.5.14",
6161
"@types/node": "^22.13.1",

yarn.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9246,10 +9246,10 @@ __metadata:
92469246
languageName: node
92479247
linkType: hard
92489248

9249-
"@sentry/babel-plugin-component-annotate@npm:4.2.0":
9250-
version: 4.2.0
9251-
resolution: "@sentry/babel-plugin-component-annotate@npm:4.2.0"
9252-
checksum: 95e7091e78eb112cdb2a39c588af5b7f1d1f0443e4f3f1533a48eae5414ee553d97310547685c8decd9afebc69f7c05342b8c7ee2124cad78b478e6d7131c886
9249+
"@sentry/babel-plugin-component-annotate@npm:4.3.0":
9250+
version: 4.3.0
9251+
resolution: "@sentry/babel-plugin-component-annotate@npm:4.3.0"
9252+
checksum: c42f49e44140929b45ede8a5a06bdf8d5f4ceb6f989ebfc16d3085db4a444bce7ffee9829791baccc89c1a74d394128d7b6d0b476e48aad969a3147759378afb
92539253
languageName: node
92549254
linkType: hard
92559255

@@ -9415,13 +9415,13 @@ __metadata:
94159415
"@sentry-internal/eslint-config-sdk": 10.8.0
94169416
"@sentry-internal/eslint-plugin-sdk": 10.8.0
94179417
"@sentry-internal/typescript": 10.8.0
9418-
"@sentry/babel-plugin-component-annotate": 4.2.0
9418+
"@sentry/babel-plugin-component-annotate": 4.3.0
94199419
"@sentry/browser": 10.8.0
94209420
"@sentry/cli": 2.53.0
94219421
"@sentry/core": 10.8.0
94229422
"@sentry/react": 10.8.0
94239423
"@sentry/types": 10.8.0
9424-
"@sentry/wizard": 6.3.0
9424+
"@sentry/wizard": 6.4.0
94259425
"@testing-library/react-native": ^12.7.2
94269426
"@types/jest": ^29.5.13
94279427
"@types/node": ^20.9.3
@@ -9504,9 +9504,9 @@ __metadata:
95049504
languageName: node
95059505
linkType: hard
95069506

9507-
"@sentry/wizard@npm:6.3.0":
9508-
version: 6.3.0
9509-
resolution: "@sentry/wizard@npm:6.3.0"
9507+
"@sentry/wizard@npm:6.4.0":
9508+
version: 6.4.0
9509+
resolution: "@sentry/wizard@npm:6.4.0"
95109510
dependencies:
95119511
"@clack/prompts": 0.7.0
95129512
"@sentry/node": ^7.119.2
@@ -9524,7 +9524,7 @@ __metadata:
95249524
yargs: ^16.2.0
95259525
bin:
95269526
sentry-wizard: dist/bin.js
9527-
checksum: 15ef7f1820ab9cbb5b0c3a840ff2f43c29b7969a8999980dae5e775efe0fa3ee99b64dbb7218d53d8c78f2f9e77fde86133a562710437f85d287ec2b21725579
9527+
checksum: b95f76ef04f5c4d135c0ad01b612ab86cdde6f2a1de4c2e1be24539e2f371967a8488c8966fb9a2bde4c63d3ad04250f25efbd458e5bf227f3cb4cb1bec41082
95289528
languageName: node
95299529
linkType: hard
95309530

@@ -27349,7 +27349,7 @@ __metadata:
2734927349
dependencies:
2735027350
"@babel/core": ^7.26.0
2735127351
"@babel/preset-env": ^7.26.0
27352-
"@sentry/babel-plugin-component-annotate": 4.2.0
27352+
"@sentry/babel-plugin-component-annotate": 4.3.0
2735327353
"@sentry/react-native": 7.0.0
2735427354
"@types/node": 20.10.4
2735527355
"@types/react": ~19.0.10
@@ -27434,7 +27434,7 @@ __metadata:
2743427434
"@react-navigation/native": 7.1.8
2743527435
"@react-navigation/native-stack": 7.3.12
2743627436
"@react-navigation/stack": 7.3.1
27437-
"@sentry/babel-plugin-component-annotate": 4.2.0
27437+
"@sentry/babel-plugin-component-annotate": 4.3.0
2743827438
"@sentry/core": 10.8.0
2743927439
"@sentry/react-native": 7.0.0
2744027440
"@shopify/flash-list": 1.8.0

0 commit comments

Comments
 (0)