@sentry/react-native 3.2.1 → 3.2.5

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,12 +1,29 @@
1
1
  # Changelog
2
2
 
3
- - feat(ios): Missing config `enableOutOfMemoryTracking` on iOS/Mac #1858
3
+ ## 3.2.5
4
+
5
+ - fix: Fix dynamic require for promise options bypassing try catch block and crashing apps #1923
6
+
7
+ ## 3.2.4
8
+
9
+ - fix: Warn when promise rejections won't be caught #1886
10
+ - Bump: Sentry Android to 5.4.3 and Sentry Cocoa to 7.5.4 #1920
11
+
12
+ ## 3.2.3
13
+
14
+ ### Various fixes & improvements
15
+
16
+ - fix(ios): tracesSampler becomes NSNull in iOS and the app cannot be started (#1872) by @marandaneto
17
+
18
+ ## 3.2.2
19
+
20
+ - Bump Sentry Android SDK to 5.3.0 #1860
4
21
 
5
22
  ## 3.2.1
6
23
 
7
24
  ### Various fixes & improvements
8
25
 
9
- - feat(ios): Missing config on iOS/Mac. (#1858) by @marandaneto
26
+ - feat(ios): Missing config `enableOutOfMemoryTracking` on iOS/Mac (#1858) by @marandaneto
10
27
 
11
28
  ## 3.2.0
12
29
 
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.4.8'
20
+ s.dependency 'Sentry', '7.5.4'
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.2.4'
27
+ api 'io.sentry:sentry-android:5.4.3'
28
28
  }
@@ -26,6 +26,14 @@ export declare class ReactNativeErrorHandlers implements Integration {
26
26
  * Handle Promises
27
27
  */
28
28
  private _handleUnhandledRejections;
29
+ /**
30
+ * Gets the promise rejection handlers, tries to get React Native's default one but otherwise will default to console.logging unhandled rejections.
31
+ */
32
+ private _getPromiseRejectionTrackingOptions;
33
+ /**
34
+ * Checks if the promise is the same one or not, if not it will warn the user
35
+ */
36
+ private _checkPromiseVersion;
29
37
  /**
30
38
  * Handle errors
31
39
  */
@@ -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;AAKD,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;IAgElC;;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;CAC/B;AAWD,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;IAoB3C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,cAAc;CAkEvB"}
@@ -24,59 +24,75 @@ export class ReactNativeErrorHandlers {
24
24
  * Handle Promises
25
25
  */
26
26
  _handleUnhandledRejections() {
27
- var _a, _b;
28
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();
29
34
  const tracking = require("promise/setimmediate/rejection-tracking");
35
+ const promiseRejectionTrackingOptions = this._getPromiseRejectionTrackingOptions();
30
36
  tracking.disable();
31
37
  tracking.enable({
32
38
  allRejections: true,
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
39
  onUnhandled: (id, error) => {
35
40
  if (__DEV__) {
36
- // We mimic the behavior of unhandled promise rejections showing up as a warning.
37
- // eslint-disable-next-line no-console
38
- console.warn(id, error);
41
+ promiseRejectionTrackingOptions.onUnhandled(id, error);
39
42
  }
40
43
  getCurrentHub().captureException(error, {
41
44
  data: { id },
42
45
  originalException: error,
43
46
  });
44
47
  },
48
+ onHandled: (id) => {
49
+ promiseRejectionTrackingOptions.onHandled(id);
50
+ },
45
51
  });
46
- /* eslint-disable
47
- @typescript-eslint/no-var-requires,
48
- import/no-extraneous-dependencies,
49
- @typescript-eslint/no-explicit-any,
50
- @typescript-eslint/no-unsafe-member-access
51
- */
52
+ }
53
+ }
54
+ /**
55
+ * Gets the promise rejection handlers, tries to get React Native's default one but otherwise will default to console.logging unhandled rejections.
56
+ */
57
+ _getPromiseRejectionTrackingOptions() {
58
+ const moduleName = "react-native/Libraries/promiseRejectionTrackingOptions";
59
+ try {
60
+ // Here we try to use React Native's original promise rejection handler.
61
+ // NOTE: We also need to define the module name as a variable and use .call instead of just calling require() like usual otherwise metro will try to fetch the dependency and ignore the try catch.
62
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access
63
+ return require.call(null, moduleName).default;
64
+ }
65
+ catch (e) {
66
+ // Default behavior if the React Native promise rejection handlers are not available such as an older RN version
67
+ return {
68
+ allRejections: true,
69
+ onUnhandled: (_id, error) => {
70
+ // eslint-disable-next-line no-console
71
+ console.warn(error);
72
+ },
73
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
74
+ onHandled: (_id) => { },
75
+ };
76
+ }
77
+ }
78
+ /**
79
+ * Checks if the promise is the same one or not, if not it will warn the user
80
+ */
81
+ _checkPromiseVersion() {
82
+ try {
83
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies
52
84
  const Promise = require("promise/setimmediate/core");
53
85
  const _global = getGlobalObject();
54
- /* In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.
55
- Due to this, we need to take the methods that tracking.enable sets, and then set them on the global promise.
56
- Note: We do not want to overwrite the whole promise in case there are extensions present.
57
-
58
- If the global promise is the same as the imported promise (expected in RN <0.63), we do nothing.
59
- */
60
- const _onHandle = (_a = Promise._onHandle) !== null && _a !== void 0 ? _a : Promise._Y;
61
- const _onReject = (_b = Promise._onReject) !== null && _b !== void 0 ? _b : Promise._Z;
62
- if (Promise !== _global.Promise &&
63
- typeof _onHandle !== "undefined" &&
64
- typeof _onReject !== "undefined") {
65
- if ("_onHandle" in _global.Promise && "_onReject" in _global.Promise) {
66
- _global.Promise._onHandle = _onHandle;
67
- _global.Promise._onReject = _onReject;
68
- }
69
- else if ("_Y" in _global.Promise && "_Z" in _global.Promise) {
70
- _global.Promise._Y = _onHandle;
71
- _global.Promise._Z = _onReject;
72
- }
86
+ if (Promise !== _global.Promise) {
87
+ logger.warn("Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.");
73
88
  }
74
- /* eslint-enable
75
- @typescript-eslint/no-var-requires,
76
- import/no-extraneous-dependencies,
77
- @typescript-eslint/no-explicit-any,
78
- @typescript-eslint/no-unsafe-member-access
79
- */
89
+ else {
90
+ logger.log("Unhandled promise rejections will be caught by Sentry.");
91
+ }
92
+ }
93
+ catch (e) {
94
+ // Do Nothing
95
+ logger.warn("Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.");
80
96
  }
81
97
  }
82
98
  /**
@@ -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,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;AAa/E,2CAA2C;AAC3C,MAAM,OAAO,wBAAwB;IAcnC,kBAAkB;IAClB,YAAmB,OAAyC;QAT5D;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mBACX,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,IACvB,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAClC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,0BAA0B;;QAChC,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EA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wBACd,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;iBACJ;gBAED,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAE/B,IAAI,CAAC,OAAO,EAAE;oBACZ,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBAC3D,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,gFAAgF;oBAChF,mCAAmC;oBACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AArKD;;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\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 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 tracking.disable();\n tracking.enable({\n allRejections: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onUnhandled: (id: any, error: any) => {\n if (__DEV__) {\n // We mimic the behavior of unhandled promise rejections showing up as a warning.\n // eslint-disable-next-line no-console\n console.warn(id, error);\n }\n getCurrentHub().captureException(error, {\n data: { id },\n originalException: error,\n });\n },\n });\n\n /* eslint-disable\n @typescript-eslint/no-var-requires,\n import/no-extraneous-dependencies,\n @typescript-eslint/no-explicit-any,\n @typescript-eslint/no-unsafe-member-access\n */\n const Promise = require(\"promise/setimmediate/core\");\n const _global = getGlobalObject<any>();\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 Due to this, we need to take the methods that tracking.enable sets, and then set them on the global promise.\n Note: We do not want to overwrite the whole promise in case there are extensions present.\n\n If the global promise is the same as the imported promise (expected in RN <0.63), we do nothing.\n */\n const _onHandle = Promise._onHandle ?? Promise._Y;\n const _onReject = Promise._onReject ?? Promise._Z;\n\n if (\n Promise !== _global.Promise &&\n typeof _onHandle !== \"undefined\" &&\n typeof _onReject !== \"undefined\"\n ) {\n if (\"_onHandle\" in _global.Promise && \"_onReject\" in _global.Promise) {\n _global.Promise._onHandle = _onHandle;\n _global.Promise._onReject = _onReject;\n } else if (\"_Y\" in _global.Promise && \"_Z\" in _global.Promise) {\n _global.Promise._Y = _onHandle;\n _global.Promise._Z = _onReject;\n }\n }\n /* eslint-enable\n @typescript-eslint/no-var-requires,\n import/no-extraneous-dependencies,\n @typescript-eslint/no-explicit-any,\n @typescript-eslint/no-unsafe-member-access\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,OAAyC;QAT5D;;WAEG;QACI,SAAI,GAAW,wBAAwB,CAAC,EAAE,CAAC;QAOhD,IAAI,CAAC,QAAQ,mB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E,CAAC;gBACnC,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAqB,CAAC;gBAEzD,IAAI,CAAC,MAAM,EAAE;oBACX,MAAM,CAAC,KAAK,CACV,0DAA0D,EAC1D,KAAK,CACN,CAAC;oBAEF,+EAA+E;oBAC/E,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBAE/B,OAAO;iBACR;gBAED,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;gBAEpC,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE;oBACrD,iBAAiB,EAAE,KAAK;iBACzB,CAAC,CAAC;gBAEH,IAAI,OAAO,EAAE;oBACX,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;oBAE7B,qBAAqB,CAAC,KAAK,EAAE;wBAC3B,OAAO,EAAE,KAAK;wBACd,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;iBACJ;gBAED,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAE/B,IAAI,CAAC,OAAO,EAAE;oBACZ,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBAC3D,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;iBACJ;qBAAM;oBACL,gFAAgF;oBAChF,mCAAmC;oBACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBAChC;YACH,CAAC,CAAA,CAAC,CAAC;SACJ;IACH,CAAC;;AAxLD;;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 allRejections: boolean;\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 const moduleName = \"react-native/Libraries/promiseRejectionTrackingOptions\";\n try {\n // Here we try to use React Native's original promise rejection handler.\n // NOTE: We also need to define the module name as a variable and use .call instead of just calling require() like usual otherwise metro will try to fetch the dependency and ignore the try catch.\n // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access\n return require.call(null, moduleName).default;\n } catch (e) {\n // Default behavior if the React Native promise rejection handlers are not available such as an older RN version\n return {\n allRejections: true,\n onUnhandled: (_id: string, error: unknown) => {\n // eslint-disable-next-line no-console\n console.warn(error);\n },\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onHandled: (_id: string) => {},\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,3 +1,3 @@
1
1
  export declare const SDK_NAME = "sentry.javascript.react-native";
2
- export declare const SDK_VERSION = "3.2.1";
2
+ export declare const SDK_VERSION = "3.2.5";
3
3
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export const SDK_NAME = "sentry.javascript.react-native";
2
- export const SDK_VERSION = "3.2.1";
2
+ export const SDK_VERSION = "3.2.5";
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.1\";\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,OAAO,CAAC","sourcesContent":["export const SDK_NAME = \"sentry.javascript.react-native\";\nexport const SDK_VERSION = \"3.2.5\";\n"]}
package/ios/RNSentry.m CHANGED
@@ -62,7 +62,14 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
62
62
  return event;
63
63
  };
64
64
 
65
- [options setValue:beforeSend forKey:@"beforeSend"];
65
+ NSMutableDictionary * mutableOptions =[options mutableCopy];
66
+ [mutableOptions setValue:beforeSend forKey:@"beforeSend"];
67
+
68
+ // remove performance traces sample rate and traces sampler since we don't want to synchronize these configurations
69
+ // to the Native SDKs.
70
+ // The user could tho initialize the SDK manually and set themselves.
71
+ [mutableOptions removeObjectForKey:@"tracesSampleRate"];
72
+ [mutableOptions removeObjectForKey:@"tracesSampler"];
66
73
 
67
74
  sentryOptions = [[SentryOptions alloc] initWithDict:options didFailWithError:&error];
68
75
  if (error) {
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.1",
5
+ "version": "3.2.5",
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,20 +41,20 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@sentry/browser": "6.12.0",
44
+ "@sentry/cli": "^1.68.0",
44
45
  "@sentry/core": "6.12.0",
45
46
  "@sentry/hub": "6.12.0",
46
47
  "@sentry/integrations": "6.12.0",
47
48
  "@sentry/react": "6.12.0",
48
49
  "@sentry/tracing": "6.12.0",
49
50
  "@sentry/types": "6.12.0",
50
- "@sentry/utils": "6.12.0",
51
- "@sentry/cli": "^1.68.0"
51
+ "@sentry/utils": "6.12.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@sentry-internal/eslint-config-sdk": "6.12.0",
55
55
  "@sentry-internal/eslint-plugin-sdk": "6.12.0",
56
56
  "@sentry/typescript": "^5.20.0",
57
- "@sentry/wizard": "^1.2.2",
57
+ "@sentry/wizard": "^1.2.15",
58
58
  "@types/jest": "^26.0.15",
59
59
  "@types/react": "^16.9.49",
60
60
  "@types/react-native": "^0.65.3",