@sentry/react-native 3.2.2 → 3.2.6

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.6
4
+
5
+ - feat(android): Support monorepo in gradle plugin #1917
6
+ - fix: Remove dependency on promiseRejectionTrackingOptions #1928
7
+
8
+ ## 3.2.5
9
+
10
+ - fix: Fix dynamic require for promise options bypassing try catch block and crashing apps #1923
11
+
12
+ ## 3.2.4
13
+
14
+ - fix: Warn when promise rejections won't be caught #1886
15
+ - Bump: Sentry Android to 5.4.3 and Sentry Cocoa to 7.5.4 #1920
16
+
17
+ ## 3.2.3
18
+
19
+ ### Various fixes & improvements
20
+
21
+ - fix(ios): tracesSampler becomes NSNull in iOS and the app cannot be started (#1872) by @marandaneto
22
+
3
23
  ## 3.2.2
4
24
 
5
25
  - Bump Sentry Android SDK to 5.3.0 #1860
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.3.0'
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;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"}
@@ -24,59 +24,68 @@ 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
+ return {
59
+ onUnhandled: (id, rejection = {}) => {
60
+ // eslint-disable-next-line no-console
61
+ console.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`);
62
+ },
63
+ onHandled: (id) => {
64
+ // eslint-disable-next-line no-console
65
+ console.warn(`Promise Rejection Handled (id: ${id})\n` +
66
+ "This means you can ignore any previous messages of the form " +
67
+ `"Possible Unhandled Promise Rejection (id: ${id}):"`);
68
+ },
69
+ };
70
+ }
71
+ /**
72
+ * Checks if the promise is the same one or not, if not it will warn the user
73
+ */
74
+ _checkPromiseVersion() {
75
+ try {
76
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies
52
77
  const Promise = require("promise/setimmediate/core");
53
78
  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
- }
79
+ if (Promise !== _global.Promise) {
80
+ logger.warn("Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.");
73
81
  }
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
- */
82
+ else {
83
+ logger.log("Unhandled promise rejections will be caught by Sentry.");
84
+ }
85
+ }
86
+ catch (e) {
87
+ // Do Nothing
88
+ logger.warn("Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.");
80
89
  }
81
90
  }
82
91
  /**
@@ -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,EAAE;YACtC,MAAM,QAAQ,GAIV,OAAO,CAAC,yCAAyC,CAAC,CAAC;YAEvD,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnB,QAAQ,CAAC,MAAM,CAAC;gBACd,aAAa,EAAE,IAAI;gBACnB,8DAA8D;gBAC9D,WAAW,EAAE,CAAC,EAAO,EAAE,KAAU,EAAE,EAAE;oBACnC,IAAI,OAAO,EAAE;wBACX,iFAAiF;wBACjF,sCAAsC;wBACtC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,KA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L,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;AAkB/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,EAAE;YACtC;;;;cAIE;YACF,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAE5B,M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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;;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,3 +1,3 @@
1
1
  export declare const SDK_NAME = "sentry.javascript.react-native";
2
- export declare const SDK_VERSION = "3.2.2";
2
+ export declare const SDK_VERSION = "3.2.6";
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.2";
2
+ export const SDK_VERSION = "3.2.6";
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.2\";\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.6\";\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.2",
5
+ "version": "3.2.6",
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",
package/sentry.gradle CHANGED
@@ -92,7 +92,13 @@ gradle.projectsEvaluated {
92
92
  } catch (FileNotFoundException e) {
93
93
  project.logger.info("file not found '$propertiesFile' for '$variant'")
94
94
  }
95
- def cliExecutable = sentryProps.get("cli.executable", "$reactRoot/node_modules/@sentry/cli/bin/sentry-cli")
95
+
96
+ def resolvedCliPackage = null
97
+ try {
98
+ resolvedCliPackage = new File(["node", "--print", "require.resolve('@sentry/cli/package.json')"].execute(null, rootDir).text.trim()).getParentFile();
99
+ } catch (Throwable ignored) {}
100
+ def cliPackage = resolvedCliPackage != null && resolvedCliPackage.exists() ? resolvedCliPackage.getAbsolutePath() : "$reactRoot/node_modules/@sentry/cli"
101
+ def cliExecutable = sentryProps.get("cli.executable", "$cliPackage/bin/sentry-cli")
96
102
 
97
103
  // fix path separator for Windows
98
104
  if (Os.isFamily(Os.FAMILY_WINDOWS)) {