@sentry/react-native 3.2.9 → 3.2.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.2.13
4
+
5
+ - fix(deps): Add `@sentry/wizard` back in as a dependency to avoid missing dependency when running react-native link. #2015
6
+ - Bump: sentry-cli to 1.72.0 #2016
7
+
8
+ ## 3.2.12
9
+
10
+ - fix: fetchNativeDeviceContexts returns an empty Array if no Device Context available #2002
11
+ - Bump: Sentry Cocoa 7.9.0 #2011
12
+
13
+ ## 3.2.11
14
+
15
+ - fix: Polyfill the promise library to permanently fix unhandled rejections #1984
16
+
17
+ ## 3.2.10
18
+
19
+ - fix: Do not crash if androidx.core isn't available on Android #1981
20
+ - fix: App start measurement on Android #1985
21
+ - Bump: Sentry Android to 5.5.2 #1985
22
+
3
23
  ## 3.2.9
4
24
 
5
25
  - Deprecate initialScope in favor of configureScope #1963
package/RNSentry.podspec CHANGED
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.preserve_paths = '*.js'
18
18
 
19
19
  s.dependency 'React-Core'
20
- s.dependency 'Sentry', '7.7.0'
20
+ s.dependency 'Sentry', '7.9.0'
21
21
 
22
22
  s.source_files = 'ios/RNSentry.{h,m}'
23
23
  s.public_header_files = 'ios/RNSentry.h'
@@ -24,5 +24,5 @@ android {
24
24
 
25
25
  dependencies {
26
26
  implementation 'com.facebook.react:react-native:+'
27
- api 'io.sentry:sentry-android:5.5.1'
27
+ api 'io.sentry:sentry-android:5.5.2'
28
28
  }
@@ -52,20 +52,21 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
52
52
 
53
53
  public static final String NAME = "RNSentry";
54
54
 
55
- final static Logger logger = Logger.getLogger("react-native-sentry");
55
+ private static final Logger logger = Logger.getLogger("react-native-sentry");
56
56
 
57
- private static PackageInfo packageInfo;
58
- private static boolean didFetchAppStart = false;
59
- private static FrameMetricsAggregator frameMetricsAggregator = null;
57
+ private PackageInfo packageInfo = null;
58
+ private boolean didFetchAppStart;
59
+ private FrameMetricsAggregator frameMetricsAggregator = null;
60
+ private boolean androidXAvailable = true;
60
61
 
61
62
  // 700ms to constitute frozen frames.
62
- private final int FROZEN_FRAME_THRESHOLD = 700;
63
+ private static final int FROZEN_FRAME_THRESHOLD = 700;
63
64
  // 16ms (slower than 60fps) to constitute slow frames.
64
- private final int SLOW_FRAME_THRESHOLD = 16;
65
+ private static final int SLOW_FRAME_THRESHOLD = 16;
65
66
 
66
67
  public RNSentryModule(ReactApplicationContext reactContext) {
67
68
  super(reactContext);
68
- RNSentryModule.packageInfo = getPackageInfo(reactContext);
69
+ packageInfo = getPackageInfo(reactContext);
69
70
  }
70
71
 
71
72
  @Override
@@ -130,17 +131,23 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
130
131
  }
131
132
  if (rnOptions.hasKey("enableAutoPerformanceTracking")
132
133
  && rnOptions.getBoolean("enableAutoPerformanceTracking")) {
133
- RNSentryModule.frameMetricsAggregator = new FrameMetricsAggregator();
134
- Activity currentActivity = getCurrentActivity();
135
-
136
- if (currentActivity != null) {
137
- try {
138
- RNSentryModule.frameMetricsAggregator.add(currentActivity);
139
- } catch (Throwable ignored) {
140
- // throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
141
- // this is a best effort since we can't reproduce it
142
- logger.warning("Error adding Activity to frameMetricsAggregator.");
134
+ androidXAvailable = checkAndroidXAvailability();
135
+
136
+ if (androidXAvailable) {
137
+ frameMetricsAggregator = new FrameMetricsAggregator();
138
+ final Activity currentActivity = getCurrentActivity();
139
+
140
+ if (frameMetricsAggregator != null && currentActivity != null) {
141
+ try {
142
+ frameMetricsAggregator.add(currentActivity);
143
+ } catch (Throwable ignored) {
144
+ // throws ConcurrentModification when calling addOnFrameMetricsAvailableListener
145
+ // this is a best effort since we can't reproduce it
146
+ logger.warning("Error adding Activity to frameMetricsAggregator.");
147
+ }
143
148
  }
149
+ } else {
150
+ logger.warning("androidx.core' isn't available as a dependency.");
144
151
  }
145
152
  } else {
146
153
  this.disableNativeFramesTracking();
@@ -199,8 +206,13 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
199
206
  public void fetchNativeAppStart(Promise promise) {
200
207
  final AppStartState appStartInstance = AppStartState.getInstance();
201
208
  final Date appStartTime = appStartInstance.getAppStartTime();
209
+ final Boolean isColdStart = appStartInstance.isColdStart();
202
210
 
203
211
  if (appStartTime == null) {
212
+ logger.warning("App start won't be sent due to missing appStartTime.");
213
+ promise.resolve(null);
214
+ } else if (isColdStart == null) {
215
+ logger.warning("App start won't be sent due to missing isColdStart.");
204
216
  promise.resolve(null);
205
217
  } else {
206
218
  final double appStartTimestamp = (double) appStartTime.getTime();
@@ -208,15 +220,15 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
208
220
  WritableMap appStart = Arguments.createMap();
209
221
 
210
222
  appStart.putDouble("appStartTime", appStartTimestamp);
211
- appStart.putBoolean("isColdStart", appStartInstance.isColdStart());
212
- appStart.putBoolean("didFetchAppStart", RNSentryModule.didFetchAppStart);
223
+ appStart.putBoolean("isColdStart", isColdStart);
224
+ appStart.putBoolean("didFetchAppStart", didFetchAppStart);
213
225
 
214
226
  promise.resolve(appStart);
215
227
  }
216
228
  // This is always set to true, as we would only allow an app start fetch to only
217
229
  // happen once in the case of a JS bundle reload, we do not want it to be
218
230
  // instrumented again.
219
- RNSentryModule.didFetchAppStart = true;
231
+ didFetchAppStart = true;
220
232
  }
221
233
 
222
234
  /**
@@ -224,7 +236,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
224
236
  */
225
237
  @ReactMethod
226
238
  public void fetchNativeFrames(Promise promise) {
227
- if (RNSentryModule.frameMetricsAggregator == null) {
239
+ if (!isFrameMetricsAggregatorAvailable()) {
228
240
  promise.resolve(null);
229
241
  } else {
230
242
  try {
@@ -232,7 +244,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
232
244
  int slowFrames = 0;
233
245
  int frozenFrames = 0;
234
246
 
235
- final SparseIntArray[] framesRates = RNSentryModule.frameMetricsAggregator.getMetrics();
247
+ final SparseIntArray[] framesRates = frameMetricsAggregator.getMetrics();
236
248
 
237
249
  if (framesRates != null) {
238
250
  final SparseIntArray totalIndexArray = framesRates[FrameMetricsAggregator.TOTAL_INDEX];
@@ -436,9 +448,9 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
436
448
 
437
449
  @ReactMethod
438
450
  public void disableNativeFramesTracking() {
439
- if (RNSentryModule.frameMetricsAggregator != null) {
440
- RNSentryModule.frameMetricsAggregator.stop();
441
- RNSentryModule.frameMetricsAggregator = null;
451
+ if (isFrameMetricsAggregatorAvailable()) {
452
+ frameMetricsAggregator.stop();
453
+ frameMetricsAggregator = null;
442
454
  }
443
455
  }
444
456
 
@@ -485,4 +497,18 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
485
497
  event.setSdk(eventSdk);
486
498
  }
487
499
  }
500
+
501
+ private boolean checkAndroidXAvailability() {
502
+ try {
503
+ Class.forName("androidx.core.app.FrameMetricsAggregator");
504
+ return true;
505
+ } catch (ClassNotFoundException ignored) {
506
+ // androidx.core isn't available.
507
+ return false;
508
+ }
509
+ }
510
+
511
+ private boolean isFrameMetricsAggregatorAvailable() {
512
+ return androidXAvailable && frameMetricsAggregator != null;
513
+ }
488
514
  }
@@ -3,6 +3,7 @@ import { Integration } from "@sentry/types";
3
3
  interface ReactNativeErrorHandlersOptions {
4
4
  onerror: boolean;
5
5
  onunhandledrejection: boolean;
6
+ patchGlobalPromise: boolean;
6
7
  }
7
8
  /** ReactNativeErrorHandlers Integration */
8
9
  export declare class ReactNativeErrorHandlers implements Integration {
@@ -17,7 +18,7 @@ export declare class ReactNativeErrorHandlers implements Integration {
17
18
  /** ReactNativeOptions */
18
19
  private readonly _options;
19
20
  /** Constructor */
20
- constructor(options?: ReactNativeErrorHandlersOptions);
21
+ constructor(options?: Partial<ReactNativeErrorHandlersOptions>);
21
22
  /**
22
23
  * @inheritDoc
23
24
  */
@@ -27,13 +28,23 @@ export declare class ReactNativeErrorHandlers implements Integration {
27
28
  */
28
29
  private _handleUnhandledRejections;
29
30
  /**
30
- * Gets the promise rejection handlers, tries to get React Native's default one but otherwise will default to console.logging unhandled rejections.
31
+ * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.
32
+ *
33
+ * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.
34
+ * This is due to a version mismatch between promise versions.
35
+ * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,
36
+ * - Using a package resolution requires the you to manually troubleshoot.
37
+ * - The package resolution fix no longer works with 0.67 on iOS Hermes.
31
38
  */
32
- private _getPromiseRejectionTrackingOptions;
39
+ private _polyfillPromise;
40
+ /**
41
+ * Attach the unhandled rejection handler
42
+ */
43
+ private _attachUnhandledRejectionHandler;
33
44
  /**
34
45
  * Checks if the promise is the same one or not, if not it will warn the user
35
46
  */
36
- private _checkPromiseVersion;
47
+ private _checkPromiseAndWarn;
37
48
  /**
38
49
  * Handle errors
39
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAY,MAAM,eAAe,CAAC;AAKtD,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAUD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,+BAA+B;IAQ5D;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAoClC;;OAEG;IACH,OAAO,CAAC,mCAAmC;IAkB3C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,cAAc;CAkEvB"}
1
+ {"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAY,MAAM,eAAe,CAAC;AAKtD,uCAAuC;AACvC,UAAU,+BAA+B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAUD,2CAA2C;AAC3C,qBAAa,wBAAyB,YAAW,WAAW;IAC1D;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA8B;IAEtD;;OAEG;IACI,IAAI,EAAE,MAAM,CAA+B;IAElD,yBAAyB;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAE3D,kBAAkB;gBACC,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC;IASrE;;OAEG;IACI,SAAS,IAAI,IAAI;IAKxB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAUlC;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAyCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,cAAc;CAkEvB"}
@@ -11,7 +11,7 @@ export class ReactNativeErrorHandlers {
11
11
  * @inheritDoc
12
12
  */
13
13
  this.name = ReactNativeErrorHandlers.id;
14
- this._options = Object.assign({ onerror: true, onunhandledrejection: true }, options);
14
+ this._options = Object.assign({ onerror: true, onunhandledrejection: true, patchGlobalPromise: true }, options);
15
15
  }
16
16
  /**
17
17
  * @inheritDoc
@@ -25,37 +25,39 @@ export class ReactNativeErrorHandlers {
25
25
  */
26
26
  _handleUnhandledRejections() {
27
27
  if (this._options.onunhandledrejection) {
28
- /*
29
- In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.
30
- This is due to a version mismatch between promise versions. The version will need to be fixed with a package resolution.
31
- We first run a check and show a warning if needed.
32
- */
33
- this._checkPromiseVersion();
34
- const tracking = require("promise/setimmediate/rejection-tracking");
35
- const promiseRejectionTrackingOptions = this._getPromiseRejectionTrackingOptions();
36
- tracking.disable();
37
- tracking.enable({
38
- allRejections: true,
39
- onUnhandled: (id, error) => {
40
- if (__DEV__) {
41
- promiseRejectionTrackingOptions.onUnhandled(id, error);
42
- }
43
- getCurrentHub().captureException(error, {
44
- data: { id },
45
- originalException: error,
46
- });
47
- },
48
- onHandled: (id) => {
49
- promiseRejectionTrackingOptions.onHandled(id);
50
- },
51
- });
28
+ if (this._options.patchGlobalPromise) {
29
+ this._polyfillPromise();
30
+ }
31
+ this._attachUnhandledRejectionHandler();
32
+ this._checkPromiseAndWarn();
52
33
  }
53
34
  }
54
35
  /**
55
- * Gets the promise rejection handlers, tries to get React Native's default one but otherwise will default to console.logging unhandled rejections.
36
+ * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.
37
+ *
38
+ * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.
39
+ * This is due to a version mismatch between promise versions.
40
+ * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,
41
+ * - Using a package resolution requires the you to manually troubleshoot.
42
+ * - The package resolution fix no longer works with 0.67 on iOS Hermes.
43
+ */
44
+ _polyfillPromise() {
45
+ /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires*/
46
+ const { polyfillGlobal, } = require("react-native/Libraries/Utilities/PolyfillFunctions");
47
+ // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.
48
+ const Promise = require("promise/setimmediate/es6-extensions");
49
+ // As of RN 0.67 only done and finally are used
50
+ require("promise/setimmediate/done");
51
+ require("promise/setimmediate/finally");
52
+ polyfillGlobal("Promise", () => Promise);
53
+ /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */
54
+ }
55
+ /**
56
+ * Attach the unhandled rejection handler
56
57
  */
57
- _getPromiseRejectionTrackingOptions() {
58
- return {
58
+ _attachUnhandledRejectionHandler() {
59
+ const tracking = require("promise/setimmediate/rejection-tracking");
60
+ const promiseRejectionTrackingOptions = {
59
61
  onUnhandled: (id, rejection = {}) => {
60
62
  // eslint-disable-next-line no-console
61
63
  console.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`);
@@ -67,14 +69,29 @@ export class ReactNativeErrorHandlers {
67
69
  `"Possible Unhandled Promise Rejection (id: ${id}):"`);
68
70
  },
69
71
  };
72
+ tracking.enable({
73
+ allRejections: true,
74
+ onUnhandled: (id, error) => {
75
+ if (__DEV__) {
76
+ promiseRejectionTrackingOptions.onUnhandled(id, error);
77
+ }
78
+ getCurrentHub().captureException(error, {
79
+ data: { id },
80
+ originalException: error,
81
+ });
82
+ },
83
+ onHandled: (id) => {
84
+ promiseRejectionTrackingOptions.onHandled(id);
85
+ },
86
+ });
70
87
  }
71
88
  /**
72
89
  * Checks if the promise is the same one or not, if not it will warn the user
73
90
  */
74
- _checkPromiseVersion() {
91
+ _checkPromiseAndWarn() {
75
92
  try {
76
93
  // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies
77
- const Promise = require("promise/setimmediate/core");
94
+ const Promise = require("promise/setimmediate/es6-extensions");
78
95
  const _global = getGlobalObject();
79
96
  if (Promise !== _global.Promise) {
80
97
  logger.warn("Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.");
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,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AAtLD;;GAEG;AACW,2BAAE,GAAW,0BAA0B,CAAC","sourcesContent":["import { eventFromException } from \"@sentry/browser\";\nimport { getCurrentHub } from \"@sentry/core\";\nimport { Integration, Severity } from \"@sentry/types\";\nimport { addExceptionMechanism, getGlobalObject, logger } from \"@sentry/utils\";\n\nimport { ReactNativeClient } from \"../client\";\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const global: any;\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = \"ReactNativeErrorHandlers\";\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: ReactNativeErrorHandlersOptions) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n /*\n In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n This is due to a version mismatch between promise versions. The version will need to be fixed with a package resolution.\n We first run a check and show a warning if needed.\n */\n this._checkPromiseVersion();\n\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n } = require(\"promise/setimmediate/rejection-tracking\");\n\n const promiseRejectionTrackingOptions = this._getPromiseRejectionTrackingOptions();\n\n tracking.disable();\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n }\n /**\n * Gets the promise rejection handlers, tries to get React Native's default one but otherwise will default to console.logging unhandled rejections.\n */\n private _getPromiseRejectionTrackingOptions(): PromiseRejectionTrackingOptions {\n return {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`\n );\n },\n onHandled: (id) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n \"This means you can ignore any previous messages of the form \" +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`\n );\n },\n };\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseVersion(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require(\"promise/setimmediate/core\");\n\n const _global = getGlobalObject<{ Promise: typeof Promise }>();\n\n if (Promise !== _global.Promise) {\n logger.warn(\n \"Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.\"\n );\n } else {\n logger.log(\"Unhandled promise rejections will be caught by Sentry.\");\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n \"Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.\"\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const defaultHandler =\n ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ErrorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log(\n \"Encountered multiple fatals in a row. The latest:\",\n error\n );\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n\n if (!client) {\n logger.error(\n \"Sentry client is missing, the error event might be lost.\",\n error\n );\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const event = await eventFromException(options, error, {\n originalException: error,\n });\n\n if (isFatal) {\n event.level = Severity.Fatal;\n\n addExceptionMechanism(event, {\n handled: false,\n type: \"onerror\",\n });\n }\n\n currentHub.captureEvent(event);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAe,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAmB/E,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAkD;QATrE;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,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\nimport { getCurrentHub } from \"@sentry/core\";\nimport { Integration, Severity } from \"@sentry/types\";\nimport { addExceptionMechanism, getGlobalObject, logger } from \"@sentry/utils\";\n\nimport { ReactNativeClient } from \"../client\";\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ndeclare const global: any;\n\n/** ReactNativeErrorHandlers Integration */\nexport class ReactNativeErrorHandlers implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = \"ReactNativeErrorHandlers\";\n\n /**\n * @inheritDoc\n */\n public name: string = ReactNativeErrorHandlers.id;\n\n /** ReactNativeOptions */\n private readonly _options: ReactNativeErrorHandlersOptions;\n\n /** Constructor */\n public constructor(options?: Partial<ReactNativeErrorHandlersOptions>) {\n this._options = {\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n };\n }\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n this._handleUnhandledRejections();\n this._handleOnError();\n }\n\n /**\n * Handle Promises\n */\n private _handleUnhandledRejections(): void {\n if (this._options.onunhandledrejection) {\n if (this._options.patchGlobalPromise) {\n this._polyfillPromise();\n }\n\n this._attachUnhandledRejectionHandler();\n this._checkPromiseAndWarn();\n }\n }\n /**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\n private _polyfillPromise(): void {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires*/\n const {\n polyfillGlobal,\n } = require(\"react-native/Libraries/Utilities/PolyfillFunctions\");\n\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n const Promise = require(\"promise/setimmediate/es6-extensions\");\n\n // As of RN 0.67 only done and finally are used\n require(\"promise/setimmediate/done\");\n require(\"promise/setimmediate/finally\");\n\n polyfillGlobal(\"Promise\", () => Promise);\n /* eslint-enable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n }\n /**\n * Attach the unhandled rejection handler\n */\n private _attachUnhandledRejectionHandler(): void {\n const tracking: {\n disable: () => void;\n enable: (arg: unknown) => void;\n // eslint-disable-next-line import/no-extraneous-dependencies,@typescript-eslint/no-var-requires\n } = require(\"promise/setimmediate/rejection-tracking\");\n\n const promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, rejection = {}) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`\n );\n },\n onHandled: (id) => {\n // eslint-disable-next-line no-console\n console.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n \"This means you can ignore any previous messages of the form \" +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`\n );\n },\n };\n\n tracking.enable({\n allRejections: true,\n onUnhandled: (id: string, error: Error) => {\n if (__DEV__) {\n promiseRejectionTrackingOptions.onUnhandled(id, error);\n }\n\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n onHandled: (id: string) => {\n promiseRejectionTrackingOptions.onHandled(id);\n },\n });\n }\n /**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\n private _checkPromiseAndWarn(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const Promise = require(\"promise/setimmediate/es6-extensions\");\n\n const _global = getGlobalObject<{ Promise: typeof Promise }>();\n\n if (Promise !== _global.Promise) {\n logger.warn(\n \"Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.\"\n );\n } else {\n logger.log(\"Unhandled promise rejections will be caught by Sentry.\");\n }\n } catch (e) {\n // Do Nothing\n logger.warn(\n \"Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.\"\n );\n }\n }\n /**\n * Handle errors\n */\n private _handleOnError(): void {\n if (this._options.onerror) {\n let handlingFatal = false;\n\n const defaultHandler =\n ErrorUtils.getGlobalHandler && ErrorUtils.getGlobalHandler();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ErrorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log(\n \"Encountered multiple fatals in a row. The latest:\",\n error\n );\n return;\n }\n handlingFatal = true;\n }\n\n const currentHub = getCurrentHub();\n const client = currentHub.getClient<ReactNativeClient>();\n\n if (!client) {\n logger.error(\n \"Sentry client is missing, the error event might be lost.\",\n error\n );\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const options = client.getOptions();\n\n const event = await eventFromException(options, error, {\n originalException: error,\n });\n\n if (isFatal) {\n event.level = Severity.Fatal;\n\n addExceptionMechanism(event, {\n handled: false,\n type: \"onerror\",\n });\n }\n\n currentHub.captureEvent(event);\n\n if (!__DEV__) {\n void client.flush(options.shutdownTimeout || 2000).then(() => {\n defaultHandler(error, isFatal);\n });\n } else {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n }\n });\n }\n }\n}\n"]}
@@ -71,6 +71,15 @@ export interface ReactNativeOptions extends BrowserOptions {
71
71
  * @deprecated Use `Sentry.configureScope(...)`
72
72
  */
73
73
  initialScope?: CaptureContext;
74
+ /**
75
+ * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.
76
+ * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.
77
+ * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections
78
+ *
79
+ * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.
80
+ * @default true
81
+ */
82
+ patchGlobalPromise?: boolean;
74
83
  }
75
84
  export interface ReactNativeWrapperOptions {
76
85
  /** Props for the root React profiler */
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD;;;GAGG;AAEH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,0DAA0D;IAC1D,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC,uEAAuE;IACvE,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAEvC,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,+FAA+F;IAC/F,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;SAIK;IACL,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE;QACnB,yEAAyE;QACzE,iBAAiB,EAAE,OAAO,CAAC;KAC5B,KAAK,IAAI,CAAC;IAE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yEAAyE;QACzE,iBAAiB,EAAE,OAAO,CAAC;KAC5B,KAAK,IAAI,CAAC;IAEX,mDAAmD;IACnD,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC;;;;;;SAMK;IACL,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;OAGG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC;IAE9B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,wCAAwC;IACxC,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,8CAA8C;IAC9C,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"","sourcesContent":["import { BrowserOptions } from \"@sentry/react\";\nimport { ProfilerProps } from \"@sentry/react/dist/profiler\";\nimport { CaptureContext } from \"@sentry/types/dist/scope\";\n\nimport { TouchEventBoundaryProps } from \"./touchevents\";\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions extends BrowserOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Maximum time to wait to drain the request queue, before the process is allowed to exit. */\n shutdownTimeout?: number;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable scope sync from Java to NDK on Android */\n enableNdkScopeSync?: boolean;\n\n /** When enabled, all the threads are automatically attached to all logged events on Android */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n * */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. */\n enableAutoPerformanceTracking?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * @default true\n * */\n enableOutOfMemoryTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: ProfilerProps;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"","sourcesContent":["import { BrowserOptions } from \"@sentry/react\";\nimport { ProfilerProps } from \"@sentry/react/dist/profiler\";\nimport { CaptureContext } from \"@sentry/types/dist/scope\";\n\nimport { TouchEventBoundaryProps } from \"./touchevents\";\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions extends BrowserOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Maximum time to wait to drain the request queue, before the process is allowed to exit. */\n shutdownTimeout?: number;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable scope sync from Java to NDK on Android */\n enableNdkScopeSync?: boolean;\n\n /** When enabled, all the threads are automatically attached to all logged events on Android */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n * */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. */\n enableAutoPerformanceTracking?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * @default true\n * */\n enableOutOfMemoryTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n\n /**\n * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.\n * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.\n * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections\n *\n * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.\n * @default true\n */\n patchGlobalPromise?: boolean;\n}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: ProfilerProps;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAkB1E;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAsE5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C"}
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAmB1E;;GAEG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAwE5D;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACrC,OAAO,CAAC,EAAE,yBAAyB,GAClC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAsBxB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC;AAED;;;GAGG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAe9C;AAED;;GAEG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAU3C"}
package/dist/js/sdk.js CHANGED
@@ -21,6 +21,7 @@ const DEFAULT_OPTIONS = {
21
21
  autoInitializeNativeSdk: true,
22
22
  enableAutoPerformanceTracking: true,
23
23
  enableOutOfMemoryTracking: true,
24
+ patchGlobalPromise: true,
24
25
  };
25
26
  /**
26
27
  * Inits the SDK and returns the final options.
@@ -34,7 +35,9 @@ export function init(passedOptions) {
34
35
  typeof options.tracesSampleRate !== "undefined";
35
36
  if (options.defaultIntegrations === undefined) {
36
37
  options.defaultIntegrations = [
37
- new ReactNativeErrorHandlers(),
38
+ new ReactNativeErrorHandlers({
39
+ patchGlobalPromise: options.patchGlobalPromise,
40
+ }),
38
41
  new Release(),
39
42
  ...defaultIntegrations.filter((i) => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)),
40
43
  new EventOrigin(),
@@ -1 +1 @@
1
- {"version":3,"file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,CACvB;MAAA,EAAE,kBAAkB,CAAC,CACtB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAqB,CAAC;IAC9D,IAAI,MAAM,EAAE;QACV,MAAM,CAAC,WAAW,EAAE,CAAC;KACtB;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAqB,CAAC;YAE9D,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBAEpC,OAAO,MAAM,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAE;QAEd,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAqB,CAAC;YAE9D,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACzC;IACH,CAAC;CAAA","sourcesContent":["import { initAndBind, setExtra } from \"@sentry/core\";\nimport { Hub, makeMain } from \"@sentry/hub\";\nimport { RewriteFrames } from \"@sentry/integrations\";\nimport { defaultIntegrations, getCurrentHub } from \"@sentry/react\";\nimport { StackFrame } from \"@sentry/types\";\nimport { getGlobalObject, logger } from \"@sentry/utils\";\nimport * as React from \"react\";\n\nimport { ReactNativeClient } from \"./client\";\nimport {\n DebugSymbolicator,\n DeviceContext,\n EventOrigin,\n ReactNativeErrorHandlers,\n Release,\n SdkInfo,\n} from \"./integrations\";\nimport { ReactNativeOptions, ReactNativeWrapperOptions } from \"./options\";\nimport { ReactNativeScope } from \"./scope\";\nimport { TouchEventBoundary } from \"./touchevents\";\nimport { ReactNativeProfiler, ReactNativeTracing } from \"./tracing\";\n\nconst IGNORED_DEFAULT_INTEGRATIONS = [\n \"GlobalHandlers\", // We will use the react-native internal handlers\n \"TryCatch\", // We don't need this\n];\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNative: true,\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracking: true,\n enableOutOfMemoryTracking: true,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n const reactNativeHub = new Hub(undefined, new ReactNativeScope());\n makeMain(reactNativeHub);\n\n const options = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n };\n\n // As long as tracing is opt in with either one of these options, then this is how we determine tracing is enabled.\n const tracingEnabled =\n typeof options.tracesSampler !== \"undefined\" ||\n typeof options.tracesSampleRate !== \"undefined\";\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = [\n new ReactNativeErrorHandlers(),\n new Release(),\n ...defaultIntegrations.filter(\n (i) => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)\n ),\n new EventOrigin(),\n new SdkInfo(),\n ];\n\n if (__DEV__) {\n options.defaultIntegrations.push(new DebugSymbolicator());\n }\n\n options.defaultIntegrations.push(\n new RewriteFrames({\n iteratee: (frame: StackFrame) => {\n if (frame.filename) {\n frame.filename = frame.filename\n .replace(/^file:\\/\\//, \"\")\n .replace(/^address at /, \"\")\n .replace(/^.*\\/[^.]+(\\.app|CodePush|.*(?=\\/))/, \"\");\n\n if (\n frame.filename !== \"[native code]\" &&\n frame.filename !== \"native\"\n ) {\n const appPrefix = \"app://\";\n // We always want to have a triple slash\n frame.filename =\n frame.filename.indexOf(\"/\") === 0\n ? `${appPrefix}${frame.filename}`\n : `${appPrefix}/${frame.filename}`;\n }\n }\n return frame;\n },\n })\n );\n if (options.enableNative) {\n options.defaultIntegrations.push(new DeviceContext());\n }\n if (tracingEnabled) {\n if (options.enableAutoPerformanceTracking) {\n options.defaultIntegrations.push(new ReactNativeTracing());\n }\n }\n }\n\n initAndBind(ReactNativeClient, options);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n if (getGlobalObject<any>().HermesInternal) {\n getCurrentHub().setTag(\"hermes\", \"true\");\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const tracingIntegration = getCurrentHub().getIntegration(ReactNativeTracing);\n if (tracingIntegration) {\n tracingIntegration.useAppStartWithProfiler = true;\n }\n\n const profilerProps = {\n ...(options?.profilerProps ?? {}),\n name: RootComponent.displayName ?? \"Root\",\n };\n\n const RootApp: React.FC<P> = (appProps) => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ReactNativeProfiler {...profilerProps}>\n <RootComponent {...appProps} />\n </ReactNativeProfiler>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * Deprecated. Sets the release on the event.\n * NOTE: Does not set the release on sessions.\n * @deprecated\n */\nexport function setRelease(release: string): void {\n setExtra(\"__sentry_release\", release);\n}\n\n/**\n * Deprecated. Sets the dist on the event.\n * NOTE: Does not set the dist on sessions.\n * @deprecated\n */\nexport function setDist(dist: string): void {\n setExtra(\"__sentry_dist\", dist);\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n if (client) {\n client.nativeCrash();\n }\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) {}\n\n logger.error(\"Failed to flush the event queue.\");\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error(\"Failed to close the SDK\");\n }\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/js/sdk.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,wBAAwB,EACxB,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,O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C,SAAS,EAAqB,CAAC;YAE9D,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBAEpC,OAAO,MAAM,CAAC;aACf;YACD,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAE;QAEd,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,UAAgB,KAAK;;QACzB,IAAI;YACF,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAqB,CAAC;YAE9D,IAAI,MAAM,EAAE;gBACV,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;aACtB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;SACzC;IACH,CAAC;CAAA","sourcesContent":["import { initAndBind, setExtra } from \"@sentry/core\";\nimport { Hub, makeMain } from \"@sentry/hub\";\nimport { RewriteFrames } from \"@sentry/integrations\";\nimport { defaultIntegrations, getCurrentHub } from \"@sentry/react\";\nimport { StackFrame } from \"@sentry/types\";\nimport { getGlobalObject, logger } from \"@sentry/utils\";\nimport * as React from \"react\";\n\nimport { ReactNativeClient } from \"./client\";\nimport {\n DebugSymbolicator,\n DeviceContext,\n EventOrigin,\n ReactNativeErrorHandlers,\n Release,\n SdkInfo,\n} from \"./integrations\";\nimport { ReactNativeOptions, ReactNativeWrapperOptions } from \"./options\";\nimport { ReactNativeScope } from \"./scope\";\nimport { TouchEventBoundary } from \"./touchevents\";\nimport { ReactNativeProfiler, ReactNativeTracing } from \"./tracing\";\n\nconst IGNORED_DEFAULT_INTEGRATIONS = [\n \"GlobalHandlers\", // We will use the react-native internal handlers\n \"TryCatch\", // We don't need this\n];\nconst DEFAULT_OPTIONS: ReactNativeOptions = {\n enableNative: true,\n enableNativeCrashHandling: true,\n enableNativeNagger: true,\n autoInitializeNativeSdk: true,\n enableAutoPerformanceTracking: true,\n enableOutOfMemoryTracking: true,\n patchGlobalPromise: true,\n};\n\n/**\n * Inits the SDK and returns the final options.\n */\nexport function init(passedOptions: ReactNativeOptions): void {\n const reactNativeHub = new Hub(undefined, new ReactNativeScope());\n makeMain(reactNativeHub);\n\n const options = {\n ...DEFAULT_OPTIONS,\n ...passedOptions,\n };\n\n // As long as tracing is opt in with either one of these options, then this is how we determine tracing is enabled.\n const tracingEnabled =\n typeof options.tracesSampler !== \"undefined\" ||\n typeof options.tracesSampleRate !== \"undefined\";\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = [\n new ReactNativeErrorHandlers({\n patchGlobalPromise: options.patchGlobalPromise,\n }),\n new Release(),\n ...defaultIntegrations.filter(\n (i) => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)\n ),\n new EventOrigin(),\n new SdkInfo(),\n ];\n\n if (__DEV__) {\n options.defaultIntegrations.push(new DebugSymbolicator());\n }\n\n options.defaultIntegrations.push(\n new RewriteFrames({\n iteratee: (frame: StackFrame) => {\n if (frame.filename) {\n frame.filename = frame.filename\n .replace(/^file:\\/\\//, \"\")\n .replace(/^address at /, \"\")\n .replace(/^.*\\/[^.]+(\\.app|CodePush|.*(?=\\/))/, \"\");\n\n if (\n frame.filename !== \"[native code]\" &&\n frame.filename !== \"native\"\n ) {\n const appPrefix = \"app://\";\n // We always want to have a triple slash\n frame.filename =\n frame.filename.indexOf(\"/\") === 0\n ? `${appPrefix}${frame.filename}`\n : `${appPrefix}/${frame.filename}`;\n }\n }\n return frame;\n },\n })\n );\n if (options.enableNative) {\n options.defaultIntegrations.push(new DeviceContext());\n }\n if (tracingEnabled) {\n if (options.enableAutoPerformanceTracking) {\n options.defaultIntegrations.push(new ReactNativeTracing());\n }\n }\n }\n\n initAndBind(ReactNativeClient, options);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n if (getGlobalObject<any>().HermesInternal) {\n getCurrentHub().setTag(\"hermes\", \"true\");\n }\n}\n\n/**\n * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.\n */\nexport function wrap<P>(\n RootComponent: React.ComponentType<P>,\n options?: ReactNativeWrapperOptions\n): React.ComponentType<P> {\n const tracingIntegration = getCurrentHub().getIntegration(ReactNativeTracing);\n if (tracingIntegration) {\n tracingIntegration.useAppStartWithProfiler = true;\n }\n\n const profilerProps = {\n ...(options?.profilerProps ?? {}),\n name: RootComponent.displayName ?? \"Root\",\n };\n\n const RootApp: React.FC<P> = (appProps) => {\n return (\n <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}>\n <ReactNativeProfiler {...profilerProps}>\n <RootComponent {...appProps} />\n </ReactNativeProfiler>\n </TouchEventBoundary>\n );\n };\n\n return RootApp;\n}\n\n/**\n * Deprecated. Sets the release on the event.\n * NOTE: Does not set the release on sessions.\n * @deprecated\n */\nexport function setRelease(release: string): void {\n setExtra(\"__sentry_release\", release);\n}\n\n/**\n * Deprecated. Sets the dist on the event.\n * NOTE: Does not set the dist on sessions.\n * @deprecated\n */\nexport function setDist(dist: string): void {\n setExtra(\"__sentry_dist\", dist);\n}\n\n/**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\nexport function nativeCrash(): void {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n if (client) {\n client.nativeCrash();\n }\n}\n\n/**\n * Flushes all pending events in the queue to disk.\n * Use this before applying any realtime updates such as code-push or expo updates.\n */\nexport async function flush(): Promise<boolean> {\n try {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n\n if (client) {\n const result = await client.flush();\n\n return result;\n }\n // eslint-disable-next-line no-empty\n } catch (_) {}\n\n logger.error(\"Failed to flush the event queue.\");\n\n return false;\n}\n\n/**\n * Closes the SDK, stops sending events.\n */\nexport async function close(): Promise<void> {\n try {\n const client = getCurrentHub().getClient<ReactNativeClient>();\n\n if (client) {\n await client.close();\n }\n } catch (e) {\n logger.error(\"Failed to close the SDK\");\n }\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const SDK_NAME = "sentry.javascript.react-native";
2
- export declare const SDK_VERSION = "3.2.9";
2
+ export declare const SDK_VERSION = "3.2.13";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,mCAAmC,CAAC;AACzD,eAAO,MAAM,WAAW,WAAW,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export const SDK_NAME = "sentry.javascript.react-native";
2
- export const SDK_VERSION = "3.2.9";
2
+ export const SDK_VERSION = "3.2.13";
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.react-native\";\nexport const SDK_VERSION = \"3.2.9\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.react-native\";\nexport const SDK_VERSION = \"3.2.13\";\n"]}
package/ios/RNSentry.m CHANGED
@@ -140,19 +140,23 @@ RCT_EXPORT_METHOD(fetchNativeDeviceContexts:(RCTPromiseResolveBlock)resolve
140
140
  rejecter:(RCTPromiseRejectBlock)reject)
141
141
  {
142
142
  NSLog(@"Bridge call to: deviceContexts");
143
+ NSMutableDictionary<NSString *, id> *contexts = [NSMutableDictionary new];
143
144
  // Temp work around until sorted out this API in sentry-cocoa.
144
145
  // TODO: If the callback isnt' executed the promise wouldn't be resolved.
145
146
  [SentrySDK configureScope:^(SentryScope * _Nonnull scope) {
146
147
  NSDictionary<NSString *, id> *serializedScope = [scope serialize];
147
148
  // Scope serializes as 'context' instead of 'contexts' as it does for the event.
148
- NSDictionary<NSString *, id> *contexts = [serializedScope valueForKey:@"context"];
149
+ NSDictionary<NSString *, id> *tempContexts = [serializedScope valueForKey:@"context"];
150
+ if (tempContexts != nil) {
151
+ [contexts addEntriesFromDictionary:tempContexts];
152
+ }
149
153
  #if DEBUG
150
154
  NSData *data = [NSJSONSerialization dataWithJSONObject:contexts options:0 error:nil];
151
155
  NSString *debugContext = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
152
156
  NSLog(@"Contexts: %@", debugContext);
153
157
  #endif
154
- resolve(contexts);
155
158
  }];
159
+ resolve(contexts);
156
160
  }
157
161
 
158
162
  RCT_EXPORT_METHOD(fetchNativeAppStart:(RCTPromiseResolveBlock)resolve
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "3.2.9",
5
+ "version": "3.2.13",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -41,23 +41,23 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@sentry/browser": "6.12.0",
44
- "@sentry/cli": "^1.68.0",
44
+ "@sentry/cli": "^1.72.0",
45
45
  "@sentry/core": "6.12.0",
46
46
  "@sentry/hub": "6.12.0",
47
47
  "@sentry/integrations": "6.12.0",
48
48
  "@sentry/react": "6.12.0",
49
49
  "@sentry/tracing": "6.12.0",
50
50
  "@sentry/types": "6.12.0",
51
- "@sentry/utils": "6.12.0"
51
+ "@sentry/utils": "6.12.0",
52
+ "@sentry/wizard": "^1.2.17"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@sentry-internal/eslint-config-sdk": "6.12.0",
55
56
  "@sentry-internal/eslint-plugin-sdk": "6.12.0",
56
57
  "@sentry/typescript": "^5.20.0",
57
- "@sentry/wizard": "^1.2.15",
58
58
  "@types/jest": "^26.0.15",
59
59
  "@types/react": "^16.9.49",
60
- "@types/react-native": "^0.65.3",
60
+ "@types/react-native": "^0.66.11",
61
61
  "babel-jest": "^26.1.0",
62
62
  "eslint": "^7.6.0",
63
63
  "eslint-plugin-react": "^7.20.6",