@sentry/react-native 5.14.1 → 5.15.0

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/RNSentry.podspec +1 -1
  3. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +3 -5
  4. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +1 -1
  5. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +1 -1
  6. package/dist/js/NativeRNSentry.d.ts +1 -1
  7. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  8. package/dist/js/NativeRNSentry.js.map +1 -1
  9. package/dist/js/index.d.ts +4 -3
  10. package/dist/js/index.d.ts.map +1 -1
  11. package/dist/js/index.js.map +1 -1
  12. package/dist/js/integrations/debugsymbolicator.d.ts +25 -3
  13. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  14. package/dist/js/integrations/debugsymbolicator.js +109 -70
  15. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  16. package/dist/js/integrations/reactnativeerrorhandlers.d.ts +4 -0
  17. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  18. package/dist/js/integrations/reactnativeerrorhandlers.js +10 -1
  19. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  20. package/dist/js/tracing/index.d.ts +3 -2
  21. package/dist/js/tracing/index.d.ts.map +1 -1
  22. package/dist/js/tracing/index.js.map +1 -1
  23. package/dist/js/utils/error.d.ts +19 -0
  24. package/dist/js/utils/error.d.ts.map +1 -0
  25. package/dist/js/utils/error.js +30 -0
  26. package/dist/js/utils/error.js.map +1 -0
  27. package/dist/js/vendor/base64-js/fromByteArray.d.ts +5 -0
  28. package/dist/js/vendor/base64-js/fromByteArray.d.ts.map +1 -0
  29. package/dist/js/vendor/base64-js/fromByteArray.js +61 -0
  30. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -0
  31. package/dist/js/vendor/base64-js/index.d.ts +2 -0
  32. package/dist/js/vendor/base64-js/index.d.ts.map +1 -0
  33. package/dist/js/vendor/base64-js/index.js +2 -0
  34. package/dist/js/vendor/base64-js/index.js.map +1 -0
  35. package/dist/js/vendor/index.d.ts +2 -0
  36. package/dist/js/vendor/index.d.ts.map +1 -1
  37. package/dist/js/vendor/index.js +2 -0
  38. package/dist/js/vendor/index.js.map +1 -1
  39. package/dist/js/vendor/react-native/index.d.ts +27 -0
  40. package/dist/js/vendor/react-native/index.d.ts.map +1 -0
  41. package/dist/js/vendor/react-native/index.js +3 -0
  42. package/dist/js/vendor/react-native/index.js.map +1 -0
  43. package/dist/js/version.d.ts +1 -1
  44. package/dist/js/version.js +1 -1
  45. package/dist/js/version.js.map +1 -1
  46. package/dist/js/wrapper.d.ts.map +1 -1
  47. package/dist/js/wrapper.js +18 -12
  48. package/dist/js/wrapper.js.map +1 -1
  49. package/ios/RNSentry.mm +2 -6
  50. package/metro.d.ts +1 -0
  51. package/metro.js +1 -0
  52. package/package.json +4 -4
  53. package/{sample-new-architecture → samples/react-native}/react-native.config.js +1 -1
  54. package/scripts/sentry-xcode.sh +1 -1
  55. package/src/js/NativeRNSentry.ts +1 -1
  56. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
  57. package/ts3.8/dist/js/index.d.ts +4 -3
  58. package/ts3.8/dist/js/integrations/debugsymbolicator.d.ts +25 -3
  59. package/ts3.8/dist/js/integrations/reactnativeerrorhandlers.d.ts +4 -0
  60. package/ts3.8/dist/js/tracing/index.d.ts +3 -2
  61. package/ts3.8/dist/js/utils/error.d.ts +19 -0
  62. package/ts3.8/dist/js/vendor/base64-js/fromByteArray.d.ts +5 -0
  63. package/ts3.8/dist/js/vendor/base64-js/index.d.ts +2 -0
  64. package/ts3.8/dist/js/vendor/index.d.ts +2 -0
  65. package/ts3.8/dist/js/vendor/react-native/index.d.ts +27 -0
  66. package/ts3.8/dist/js/version.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.15.0
4
+
5
+ ### Features
6
+
7
+ - New simplified Sentry Metro Serializer export ([#3450](https://github.com/getsentry/sentry-react-native/pull/3450))
8
+
9
+ ```js
10
+ const { createSentryMetroSerializer } = require('@sentry/react-native/metro');
11
+ ```
12
+
13
+ ### Fixes
14
+
15
+ - Encode envelopes using Base64, fix array length limit when transferring over Bridge. ([#2852](https://github.com/getsentry/sentry-react-native/pull/2852))
16
+ - This fix requires a rebuild of the native app
17
+ - Symbolicate message and non-Error stacktraces locally in debug mode ([#3420](https://github.com/getsentry/sentry-react-native/pull/3420))
18
+ - Remove Sentry SDK frames from rejected promise SyntheticError stack ([#3423](https://github.com/getsentry/sentry-react-native/pull/3423))
19
+ - Fix path from Xcode scripts to Collect Modules ([#3451](https://github.com/getsentry/sentry-react-native/pull/3451))
20
+
21
+ ### Dependencies
22
+
23
+ - Bump Cocoa SDK from v8.15.2 to v8.17.1 ([#3412](https://github.com/getsentry/sentry-react-native/pull/3412))
24
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8171)
25
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.15.2...8.17.1)
26
+
3
27
  ## 5.14.1
4
28
 
5
29
  ### Fixes
package/RNSentry.podspec CHANGED
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
32
32
  s.preserve_paths = '*.js'
33
33
 
34
34
  s.dependency 'React-Core'
35
- s.dependency 'Sentry/HybridSDK', '8.15.2'
35
+ s.dependency 'Sentry/HybridSDK', '8.17.1'
36
36
 
37
37
  s.source_files = 'ios/**/*.{h,mm}'
38
38
  s.public_header_files = 'ios/RNSentry.h'
@@ -71,6 +71,7 @@ import io.sentry.protocol.SentryPackage;
71
71
  import io.sentry.protocol.User;
72
72
  import io.sentry.protocol.ViewHierarchy;
73
73
  import io.sentry.util.JsonSerializationUtils;
74
+ import io.sentry.vendor.Base64;
74
75
 
75
76
  public class RNSentryModuleImpl {
76
77
 
@@ -339,11 +340,8 @@ public class RNSentryModuleImpl {
339
340
  }
340
341
  }
341
342
 
342
- public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
343
- byte[] bytes = new byte[rawBytes.size()];
344
- for (int i = 0; i < rawBytes.size(); i++) {
345
- bytes[i] = (byte) rawBytes.getInt(i);
346
- }
343
+ public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
344
+ byte[] bytes = Base64.decode(rawBytes, Base64.DEFAULT);
347
345
 
348
346
  try {
349
347
  InternalSentrySdk.captureEnvelope(bytes);
@@ -55,7 +55,7 @@ public class RNSentryModule extends NativeRNSentrySpec {
55
55
  }
56
56
 
57
57
  @Override
58
- public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
58
+ public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
59
59
  this.impl.captureEnvelope(rawBytes, options, promise);
60
60
  }
61
61
 
@@ -54,7 +54,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
54
54
  }
55
55
 
56
56
  @ReactMethod
57
- public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
57
+ public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
58
58
  this.impl.captureEnvelope(rawBytes, options, promise);
59
59
  }
60
60
 
@@ -3,7 +3,7 @@ import type { TurboModule } from 'react-native';
3
3
  import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
4
4
  export interface Spec extends TurboModule {
5
5
  addBreadcrumb(breadcrumb: UnsafeObject): void;
6
- captureEnvelope(bytes: number[], options: {
6
+ captureEnvelope(bytes: string, options: {
7
7
  store: boolean;
8
8
  }): Promise<boolean>;
9
9
  captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM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OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;;AAGF,wBAAkE"}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwInD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: number[],\n options: {\n store: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(): { started?: boolean; error?: string };\n stopProfiling(): { profile?: string; nativeProfile?: UnsafeObject; error?: string };\n fetchNativePackageName(): Promise<string | undefined | null>;\n fetchNativeStackFramesBy(instructionsAddr: number[]): Promise<NativeStackFrames | undefined | null>;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n isColdStart: boolean;\n appStartTime: number;\n didFetchAppStart: boolean;\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
1
+ {"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwInD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nimport type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n store: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(): { started?: boolean; error?: string };\n stopProfiling(): { profile?: string; nativeProfile?: UnsafeObject; error?: string };\n fetchNativePackageName(): Promise<string | undefined | null>;\n fetchNativeStackFramesBy(instructionsAddr: number[]): Promise<NativeStackFrames | undefined | null>;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n isColdStart: boolean;\n appStartTime: number;\n didFetchAppStart: boolean;\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
@@ -1,13 +1,14 @@
1
- export { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
1
+ export type { Breadcrumb, Request, SdkInfo, Event, Exception, StackFrame, Stacktrace, Thread, User, UserFeedback, } from '@sentry/types';
2
2
  export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, getHubFromCarrier, getCurrentHub, Hub, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, } from '@sentry/core';
3
3
  export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
4
4
  export { lastEventId } from '@sentry/browser';
5
5
  import * as Integrations from './integrations';
6
6
  import { SDK_NAME, SDK_VERSION } from './version';
7
- export { ReactNativeOptions } from './options';
7
+ export type { ReactNativeOptions } from './options';
8
8
  export { ReactNativeClient } from './client';
9
9
  export { init, wrap, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, } from './sdk';
10
10
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
11
- export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, ReactNavigationTransactionContext, sentryTraceGesture, } from './tracing';
11
+ export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, sentryTraceGesture, } from './tracing';
12
+ export type { ReactNavigationTransactionContext } from './tracing';
12
13
  export { Integrations, SDK_NAME, SDK_VERSION };
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI,EAEJ,OAAO,EAEP,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAEhC,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI,EAEJ,OAAO,EAEP,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,S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ACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC;AAChC,mDAAmD;AACnD,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EAEtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startTransaction,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './measurements';\n_addTracingExtensions();\n\nexport {\n Integrations as BrowserIntegrations,\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport { lastEventId } from '@sentry/browser';\n\nimport * as Integrations from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\nexport { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport {\n init,\n wrap,\n // eslint-disable-next-line deprecation/deprecation\n setDist,\n // eslint-disable-next-line deprecation/deprecation\n setRelease,\n nativeCrash,\n flush,\n close,\n captureUserFeedback,\n withScope,\n configureScope,\n} from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n ReactNativeTracing,\n ReactNavigationV4Instrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n ReactNavigationInstrumentation,\n ReactNativeNavigationInstrumentation,\n RoutingInstrumentation,\n ReactNavigationTransactionContext,\n sentryTraceGesture,\n} from './tracing';\n\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,qBAAqB,EAAE,CAAC;AAExB,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,IAAI,EACJ,IAAI;AACJ,mDAAmD;AACnD,OAAO;AACP,mDAAmD;AACnD,UAAU,EACV,WAAW,EACX,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,cAAc,GACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,kBAAkB,EAClB,gCAAgC;AAChC,mDAAmD;AACnD,gCAAgC,EAChC,8BAA8B,EAC9B,oCAAoC,EACpC,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC","sourcesContent":["export type {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startTransaction,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n} from '@sentry/core';\n\nimport { _addTracingExtensions } from './measurements';\n_addTracingExtensions();\n\nexport {\n Integrations as BrowserIntegrations,\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport { lastEventId } from '@sentry/browser';\n\nimport * as Integrations from './integrations';\nimport { SDK_NAME, SDK_VERSION } from './version';\nexport type { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport {\n init,\n wrap,\n // eslint-disable-next-line deprecation/deprecation\n setDist,\n // eslint-disable-next-line deprecation/deprecation\n setRelease,\n nativeCrash,\n flush,\n close,\n captureUserFeedback,\n withScope,\n configureScope,\n} from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n ReactNativeTracing,\n ReactNavigationV4Instrumentation,\n // eslint-disable-next-line deprecation/deprecation\n ReactNavigationV5Instrumentation,\n ReactNavigationInstrumentation,\n ReactNativeNavigationInstrumentation,\n RoutingInstrumentation,\n sentryTraceGesture,\n} from './tracing';\nexport type { ReactNavigationTransactionContext } from './tracing';\nexport { Integrations, SDK_NAME, SDK_VERSION };\n"]}
@@ -1,4 +1,4 @@
1
- import type { Integration } from '@sentry/types';
1
+ import type { EventProcessor, Hub, Integration } from '@sentry/types';
2
2
  /**
3
3
  * React Native Error
4
4
  */
@@ -21,7 +21,7 @@ export declare class DebugSymbolicator implements Integration {
21
21
  /**
22
22
  * @inheritDoc
23
23
  */
24
- setupOnce(): void;
24
+ setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
25
25
  /**
26
26
  * Symbolicates the stack on the device talking to local dev server.
27
27
  * Mutates the passed event.
@@ -37,7 +37,13 @@ export declare class DebugSymbolicator implements Integration {
37
37
  * @param event Event
38
38
  * @param frames StackFrame[]
39
39
  */
40
- private _replaceFramesInEvent;
40
+ private _replaceExceptionFramesInEvent;
41
+ /**
42
+ * Replaces the frames in the thread of a message.
43
+ * @param event Event
44
+ * @param frames StackFrame[]
45
+ */
46
+ private _replaceThreadFramesInEvent;
41
47
  /**
42
48
  * This tries to add source context for in_app Frames
43
49
  *
@@ -45,5 +51,21 @@ export declare class DebugSymbolicator implements Integration {
45
51
  * @param getDevServer function from RN to get DevServer URL
46
52
  */
47
53
  private _addSourceContext;
54
+ /**
55
+ * Get source context for segment
56
+ */
57
+ private _fetchSourceContext;
58
+ /**
59
+ * Loads and calls RN Core Devtools parseErrorStack function.
60
+ */
61
+ private _parseErrorStack;
62
+ /**
63
+ * Loads and calls RN Core Devtools symbolicateStackTrace function.
64
+ */
65
+ private _symbolicateStackTrace;
66
+ /**
67
+ * Loads and returns the RN DevServer URL.
68
+ */
69
+ private _getDevServer;
48
70
  }
49
71
  //# sourceMappingURL=debugsymbolicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,WAAW,EAAc,MAAM,eAAe,CAAC;AAoB/E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM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;IACH,OAAO,CAAC,2BAA2B;IAMnC;;;;;OAKG;YACW,iBAAiB;IA6B/B;;OAEG;YACW,mBAAmB;IAWjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;OAEG;IACH,OAAO,CAAC,aAAa;CAUtB"}
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
- import { addGlobalEventProcessor, getCurrentHub } from '@sentry/core';
3
2
  import { addContextToFrame, logger } from '@sentry/utils';
3
+ import { getFramesToPop, isErrorLike } from '../utils/error';
4
4
  const INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\.js$', 'MessageQueue\\.js$'].join('|'));
5
5
  /** Tries to symbolicate the JS stack trace on the device. */
6
6
  export class DebugSymbolicator {
@@ -13,24 +13,29 @@ export class DebugSymbolicator {
13
13
  /**
14
14
  * @inheritDoc
15
15
  */
16
- setupOnce() {
16
+ setupOnce(addGlobalEventProcessor, getCurrentHub) {
17
17
  addGlobalEventProcessor((event, hint) => __awaiter(this, void 0, void 0, function* () {
18
18
  const self = getCurrentHub().getIntegration(DebugSymbolicator);
19
- if (!self || hint === undefined || hint.originalException === undefined) {
19
+ if (!self) {
20
20
  return event;
21
21
  }
22
- const reactError = hint.originalException;
23
- // eslint-disable-next-line @typescript-eslint/no-var-requires
24
- const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
25
- let stack;
26
- try {
27
- stack = parseErrorStack(reactError);
22
+ if (event.exception && isErrorLike(hint.originalException)) {
23
+ // originalException is ErrorLike object
24
+ const symbolicatedFrames = yield this._symbolicate(hint.originalException.stack, getFramesToPop(hint.originalException));
25
+ symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);
28
26
  }
29
- catch (e) {
30
- // In RN 0.64 `parseErrorStack` now only takes a string
31
- stack = parseErrorStack(reactError.stack);
27
+ else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {
28
+ // syntheticException is Error object
29
+ const symbolicatedFrames = yield this._symbolicate(hint.syntheticException.stack, getFramesToPop(hint.syntheticException));
30
+ if (event.exception) {
31
+ symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);
32
+ }
33
+ else if (event.threads) {
34
+ // RN JS doesn't have threads
35
+ // syntheticException is used for Sentry.captureMessage() threads
36
+ symbolicatedFrames && this._replaceThreadFramesInEvent(event, symbolicatedFrames);
37
+ }
32
38
  }
33
- yield self._symbolicate(event, stack);
34
39
  return event;
35
40
  }));
36
41
  }
@@ -38,35 +43,31 @@ export class DebugSymbolicator {
38
43
  * Symbolicates the stack on the device talking to local dev server.
39
44
  * Mutates the passed event.
40
45
  */
41
- _symbolicate(event, stack) {
46
+ _symbolicate(rawStack, skipFirstFrames = 0) {
42
47
  return __awaiter(this, void 0, void 0, function* () {
48
+ const parsedStack = this._parseErrorStack(rawStack);
43
49
  try {
44
- // eslint-disable-next-line @typescript-eslint/no-var-requires
45
- const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
46
- const prettyStack = yield symbolicateStackTrace(stack);
47
- if (prettyStack) {
48
- let newStack = prettyStack;
49
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
50
- if (prettyStack.stack) {
51
- // This has been changed in an react-native version so stack is contained in here
52
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
53
- newStack = prettyStack.stack;
54
- }
55
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
56
- const stackWithoutInternalCallsites = newStack.filter((frame) =>
57
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
58
- frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null);
59
- const symbolicatedFrames = yield this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);
60
- this._replaceFramesInEvent(event, symbolicatedFrames);
61
- }
62
- else {
63
- logger.error('The stack is null');
50
+ const prettyStack = yield this._symbolicateStackTrace(parsedStack);
51
+ if (!prettyStack) {
52
+ logger.error('React Native DevServer could not symbolicate the stack trace.');
53
+ return null;
64
54
  }
55
+ // This has been changed in an react-native version so stack is contained in here
56
+ const newStack = prettyStack.stack || prettyStack;
57
+ // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23
58
+ // Match SentryParser which counts lines of stack (-1 for first line with the Error message)
59
+ const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);
60
+ const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser
61
+ ? newStack.slice(skipFirstAdjustedToSentryStackParser)
62
+ : newStack;
63
+ const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter((frame) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null);
64
+ return yield this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);
65
65
  }
66
66
  catch (error) {
67
67
  if (error instanceof Error) {
68
68
  logger.warn(`Unable to symbolicate stack trace: ${error.message}`);
69
69
  }
70
+ return null;
70
71
  }
71
72
  });
72
73
  }
@@ -76,13 +77,6 @@ export class DebugSymbolicator {
76
77
  */
77
78
  _convertReactNativeFramesToSentryFrames(frames) {
78
79
  return __awaiter(this, void 0, void 0, function* () {
79
- let getDevServer;
80
- try {
81
- getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');
82
- }
83
- catch (_oO) {
84
- // We can't load devserver URL
85
- }
86
80
  return Promise.all(frames.map((frame) => __awaiter(this, void 0, void 0, function* () {
87
81
  let inApp = !!frame.column && !!frame.lineNumber;
88
82
  inApp =
@@ -97,18 +91,8 @@ export class DebugSymbolicator {
97
91
  function: frame.methodName,
98
92
  in_app: inApp,
99
93
  };
100
- // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and
101
- // leaves a trailing `(address at` in the function name.
102
- // `react-native@0.62` seems to have custom logic to parse hermes frames specially.
103
- // Anyway, all we do here is throw away the bogus suffix.
104
- if (newFrame.function) {
105
- const addressAtPos = newFrame.function.indexOf('(address at');
106
- if (addressAtPos >= 0) {
107
- newFrame.function = newFrame.function.substring(0, addressAtPos).trim();
108
- }
109
- }
110
94
  if (inApp) {
111
- yield this._addSourceContext(newFrame, getDevServer);
95
+ yield this._addSourceContext(newFrame);
112
96
  }
113
97
  return newFrame;
114
98
  })));
@@ -119,7 +103,7 @@ export class DebugSymbolicator {
119
103
  * @param event Event
120
104
  * @param frames StackFrame[]
121
105
  */
122
- _replaceFramesInEvent(event, frames) {
106
+ _replaceExceptionFramesInEvent(event, frames) {
123
107
  if (event.exception &&
124
108
  event.exception.values &&
125
109
  event.exception.values[0] &&
@@ -127,36 +111,91 @@ export class DebugSymbolicator {
127
111
  event.exception.values[0].stacktrace.frames = frames.reverse();
128
112
  }
129
113
  }
114
+ /**
115
+ * Replaces the frames in the thread of a message.
116
+ * @param event Event
117
+ * @param frames StackFrame[]
118
+ */
119
+ _replaceThreadFramesInEvent(event, frames) {
120
+ if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {
121
+ event.threads.values[0].stacktrace.frames = frames.reverse();
122
+ }
123
+ }
130
124
  /**
131
125
  * This tries to add source context for in_app Frames
132
126
  *
133
127
  * @param frame StackFrame
134
128
  * @param getDevServer function from RN to get DevServer URL
135
129
  */
136
- _addSourceContext(frame, getDevServer) {
137
- var _a, _b;
130
+ _addSourceContext(frame) {
131
+ var _a, _b, _c;
138
132
  return __awaiter(this, void 0, void 0, function* () {
139
- let response;
133
+ let sourceContext = null;
140
134
  const segments = (_b = (_a = frame.filename) === null || _a === void 0 ? void 0 : _a.split('/')) !== null && _b !== void 0 ? _b : [];
141
- if (getDevServer) {
142
- for (const idx in segments) {
143
- if (Object.prototype.hasOwnProperty.call(segments, idx)) {
144
- response = yield fetch(`${getDevServer().url}${segments.slice(-idx).join('/')}`, {
145
- method: 'GET',
146
- });
147
- if (response.ok) {
148
- break;
149
- }
150
- }
135
+ const serverUrl = (_c = this._getDevServer()) === null || _c === void 0 ? void 0 : _c.url;
136
+ if (!serverUrl) {
137
+ return;
138
+ }
139
+ for (const idx in segments) {
140
+ if (!Object.prototype.hasOwnProperty.call(segments, idx)) {
141
+ continue;
142
+ }
143
+ sourceContext = yield this._fetchSourceContext(serverUrl, segments, -idx);
144
+ if (sourceContext) {
145
+ break;
151
146
  }
152
147
  }
153
- if (response && response.ok) {
154
- const content = yield response.text();
155
- const lines = content.split('\n');
156
- addContextToFrame(lines, frame);
148
+ if (!sourceContext) {
149
+ return;
157
150
  }
151
+ const lines = sourceContext.split('\n');
152
+ addContextToFrame(lines, frame);
158
153
  });
159
154
  }
155
+ /**
156
+ * Get source context for segment
157
+ */
158
+ _fetchSourceContext(url, segments, start) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ const response = yield fetch(`${url}${segments.slice(start).join('/')}`, {
161
+ method: 'GET',
162
+ });
163
+ if (response.ok) {
164
+ return response.text();
165
+ }
166
+ return null;
167
+ });
168
+ }
169
+ /**
170
+ * Loads and calls RN Core Devtools parseErrorStack function.
171
+ */
172
+ _parseErrorStack(errorStack) {
173
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
174
+ const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');
175
+ return parseErrorStack(errorStack);
176
+ }
177
+ /**
178
+ * Loads and calls RN Core Devtools symbolicateStackTrace function.
179
+ */
180
+ _symbolicateStackTrace(stack, extraData) {
181
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
182
+ const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
183
+ return symbolicateStackTrace(stack, extraData);
184
+ }
185
+ /**
186
+ * Loads and returns the RN DevServer URL.
187
+ */
188
+ _getDevServer() {
189
+ try {
190
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
191
+ const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');
192
+ return getDevServer();
193
+ }
194
+ catch (_oO) {
195
+ // We can't load devserver URL
196
+ }
197
+ return undefined;
198
+ }
160
199
  }
161
200
  /**
162
201
  * @inheritDoc
@@ -1 +1 @@
1
- {"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AA2B/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAAC,EAAE,CAAC;IAqK7C,CAAC;IAnKC;;OAEG;IACI,SAAS;QACd,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAgB,EAAE,EAAE;YAC/D,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAE/D,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;gBACvE,OAAO,KAAK,CAAC;aACd;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAqC,CAAC;YAE9D,8DAA8D;YAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;YAExF,IAAI,KAAK,CAAC;YACV,IAAI;gBACF,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;aACrC;YAAC,OAAO,CAAC,EAAE;gBACV,uDAAuD;gBACvD,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aAC3C;YAED,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAEtC,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CAAC;IACL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Integration, StackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\ninterface GetDevServer {\n (): { url: string };\n}\n\n/**\n * React Native Stack Frame\n */\ninterface ReactNativeFrame {\n // arguments: []\n column: number;\n file: string;\n lineNumber: number;\n methodName: string;\n}\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(): void {\n addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self || hint === undefined || hint.originalException === undefined) {\n return event;\n }\n\n const reactError = hint.originalException as ReactNativeError;\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n\n let stack;\n try {\n stack = parseErrorStack(reactError);\n } catch (e) {\n // In RN 0.64 `parseErrorStack` now only takes a string\n stack = parseErrorStack(reactError.stack);\n }\n\n await self._symbolicate(event, stack);\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(event: Event, stack: string | undefined): Promise<void> {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n const prettyStack = await symbolicateStackTrace(stack);\n\n if (prettyStack) {\n let newStack = prettyStack;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (prettyStack.stack) {\n // This has been changed in an react-native version so stack is contained in here\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n newStack = prettyStack.stack;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const stackWithoutInternalCallsites = newStack.filter(\n (frame: { file?: string }) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n const symbolicatedFrames = await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n this._replaceFramesInEvent(event, symbolicatedFrames);\n } else {\n logger.error('The stack is null');\n }\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNativeFrame[]): Promise<StackFrame[]> {\n let getDevServer: GetDevServer;\n try {\n getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n } catch (_oO) {\n // We can't load devserver URL\n }\n return Promise.all(\n frames.map(async (frame: ReactNativeFrame): Promise<StackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: StackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n // The upstream `react-native@0.61` delegates parsing of stacks to `stacktrace-parser`, which is buggy and\n // leaves a trailing `(address at` in the function name.\n // `react-native@0.62` seems to have custom logic to parse hermes frames specially.\n // Anyway, all we do here is throw away the bogus suffix.\n if (newFrame.function) {\n const addressAtPos = newFrame.function.indexOf('(address at');\n if (addressAtPos >= 0) {\n newFrame.function = newFrame.function.substring(0, addressAtPos).trim();\n }\n }\n\n if (inApp) {\n await this._addSourceContext(newFrame, getDevServer);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceFramesInEvent(event: Event, frames: StackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: StackFrame, getDevServer?: GetDevServer): Promise<void> {\n let response;\n\n const segments = frame.filename?.split('/') ?? [];\n\n if (getDevServer) {\n for (const idx in segments) {\n if (Object.prototype.hasOwnProperty.call(segments, idx)) {\n response = await fetch(`${getDevServer().url}${segments.slice(-idx).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n break;\n }\n }\n }\n }\n\n if (response && response.ok) {\n const content = await response.text();\n const lines = content.split('\\n');\n\n addContextToFrame(lines, frame);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"debugsymbolicator.js","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7D,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAAC,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAY/G,6DAA6D;AAC7D,MAAM,OAAO,iBAAiB;IAA9B;QAKE;;WAEG;QACI,SAAI,GAAW,iBAAiB,CAAC,EAAE,CAAC;IA0N7C,CAAC;IAxNC;;OAEG;IACI,SAAS,CAAC,uBAA2D,EAAE,aAAwB;QACpG,uBAAuB,CAAC,CAAO,KAAY,EAAE,IAAe,EAAE,EAAE;YAC9D,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,iBAAiB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,sDAAsD,CAAC,CAAC;QACxF,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACK,sBAAsB,CAC5B,KAAoC,EACpC,SAAmC;QAEnC,8DAA8D;QAC9D,MAAM,qBAAqB,GAAG,OAAO,CAAC,4DAA4D,CAAC,CAAC;QACpG,OAAO,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACK,aAAa;QACnB,IAAI;YACF,8DAA8D;YAC9D,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;YAClF,OAAO,YAAY,EAAE,CAAC;SACvB;QAAC,OAAO,GAAG,EAAE;YACZ,8BAA8B;SAC/B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;;AAhOD;;GAEG;AACW,oBAAE,GAAW,mBAAmB,CAAC","sourcesContent":["import type { Event, EventHint, EventProcessor, Hub, Integration, StackFrame as SentryStackFrame } from '@sentry/types';\nimport { addContextToFrame, logger } from '@sentry/utils';\n\nimport { getFramesToPop, isErrorLike } from '../utils/error';\nimport type * as ReactNative from '../vendor/react-native';\n\nconst INTERNAL_CALLSITES_REGEX = new RegExp(['ReactNativeRenderer-dev\\\\.js$', 'MessageQueue\\\\.js$'].join('|'));\n\n/**\n * React Native Error\n */\nexport type ReactNativeError = Error & {\n framesToPop?: number;\n jsEngine?: string;\n preventSymbolication?: boolean;\n componentStack?: string;\n};\n\n/** Tries to symbolicate the JS stack trace on the device. */\nexport class DebugSymbolicator implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'DebugSymbolicator';\n /**\n * @inheritDoc\n */\n public name: string = DebugSymbolicator.id;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n addGlobalEventProcessor(async (event: Event, hint: EventHint) => {\n const self = getCurrentHub().getIntegration(DebugSymbolicator);\n\n if (!self) {\n return event;\n }\n\n if (event.exception && isErrorLike(hint.originalException)) {\n // originalException is ErrorLike object\n const symbolicatedFrames = await this._symbolicate(\n hint.originalException.stack,\n getFramesToPop(hint.originalException as Error),\n );\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (hint.syntheticException && isErrorLike(hint.syntheticException)) {\n // syntheticException is Error object\n const symbolicatedFrames = await this._symbolicate(\n hint.syntheticException.stack,\n getFramesToPop(hint.syntheticException),\n );\n\n if (event.exception) {\n symbolicatedFrames && this._replaceExceptionFramesInEvent(event, symbolicatedFrames);\n } else if (event.threads) {\n // RN JS doesn't have threads\n // syntheticException is used for Sentry.captureMessage() threads\n symbolicatedFrames && this._replaceThreadFramesInEvent(event, symbolicatedFrames);\n }\n }\n\n return event;\n });\n }\n\n /**\n * Symbolicates the stack on the device talking to local dev server.\n * Mutates the passed event.\n */\n private async _symbolicate(rawStack: string, skipFirstFrames: number = 0): Promise<SentryStackFrame[] | null> {\n const parsedStack = this._parseErrorStack(rawStack);\n\n try {\n const prettyStack = await this._symbolicateStackTrace(parsedStack);\n if (!prettyStack) {\n logger.error('React Native DevServer could not symbolicate the stack trace.');\n return null;\n }\n\n // This has been changed in an react-native version so stack is contained in here\n const newStack = prettyStack.stack || prettyStack;\n\n // https://github.com/getsentry/sentry-javascript/blob/739d904342aaf9327312f409952f14ceff4ae1ab/packages/utils/src/stacktrace.ts#L23\n // Match SentryParser which counts lines of stack (-1 for first line with the Error message)\n const skipFirstAdjustedToSentryStackParser = Math.max(skipFirstFrames - 1, 0);\n const stackWithoutPoppedFrames = skipFirstAdjustedToSentryStackParser\n ? newStack.slice(skipFirstAdjustedToSentryStackParser)\n : newStack;\n\n const stackWithoutInternalCallsites = stackWithoutPoppedFrames.filter(\n (frame: { file?: string }) => frame.file && frame.file.match(INTERNAL_CALLSITES_REGEX) === null,\n );\n\n return await this._convertReactNativeFramesToSentryFrames(stackWithoutInternalCallsites);\n } catch (error) {\n if (error instanceof Error) {\n logger.warn(`Unable to symbolicate stack trace: ${error.message}`);\n }\n return null;\n }\n }\n\n /**\n * Converts ReactNativeFrames to frames in the Sentry format\n * @param frames ReactNativeFrame[]\n */\n private async _convertReactNativeFramesToSentryFrames(frames: ReactNative.StackFrame[]): Promise<SentryStackFrame[]> {\n return Promise.all(\n frames.map(async (frame: ReactNative.StackFrame): Promise<SentryStackFrame> => {\n let inApp = !!frame.column && !!frame.lineNumber;\n inApp =\n inApp &&\n frame.file !== undefined &&\n !frame.file.includes('node_modules') &&\n !frame.file.includes('native code');\n\n const newFrame: SentryStackFrame = {\n lineno: frame.lineNumber,\n colno: frame.column,\n filename: frame.file,\n function: frame.methodName,\n in_app: inApp,\n };\n\n if (inApp) {\n await this._addSourceContext(newFrame);\n }\n\n return newFrame;\n }),\n );\n }\n\n /**\n * Replaces the frames in the exception of a error.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceExceptionFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (\n event.exception &&\n event.exception.values &&\n event.exception.values[0] &&\n event.exception.values[0].stacktrace\n ) {\n event.exception.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * Replaces the frames in the thread of a message.\n * @param event Event\n * @param frames StackFrame[]\n */\n private _replaceThreadFramesInEvent(event: Event, frames: SentryStackFrame[]): void {\n if (event.threads && event.threads.values && event.threads.values[0] && event.threads.values[0].stacktrace) {\n event.threads.values[0].stacktrace.frames = frames.reverse();\n }\n }\n\n /**\n * This tries to add source context for in_app Frames\n *\n * @param frame StackFrame\n * @param getDevServer function from RN to get DevServer URL\n */\n private async _addSourceContext(frame: SentryStackFrame): Promise<void> {\n let sourceContext: string | null = null;\n\n const segments = frame.filename?.split('/') ?? [];\n\n const serverUrl = this._getDevServer()?.url;\n if (!serverUrl) {\n return;\n }\n\n for (const idx in segments) {\n if (!Object.prototype.hasOwnProperty.call(segments, idx)) {\n continue;\n }\n\n sourceContext = await this._fetchSourceContext(serverUrl, segments, -idx);\n if (sourceContext) {\n break;\n }\n }\n\n if (!sourceContext) {\n return;\n }\n\n const lines = sourceContext.split('\\n');\n addContextToFrame(lines, frame);\n }\n\n /**\n * Get source context for segment\n */\n private async _fetchSourceContext(url: string, segments: Array<string>, start: number): Promise<string | null> {\n const response = await fetch(`${url}${segments.slice(start).join('/')}`, {\n method: 'GET',\n });\n\n if (response.ok) {\n return response.text();\n }\n return null;\n }\n\n /**\n * Loads and calls RN Core Devtools parseErrorStack function.\n */\n private _parseErrorStack(errorStack: string): Array<ReactNative.StackFrame> {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const parseErrorStack = require('react-native/Libraries/Core/Devtools/parseErrorStack');\n return parseErrorStack(errorStack);\n }\n\n /**\n * Loads and calls RN Core Devtools symbolicateStackTrace function.\n */\n private _symbolicateStackTrace(\n stack: Array<ReactNative.StackFrame>,\n extraData?: Record<string, unknown>,\n ): Promise<ReactNative.SymbolicatedStackTrace> {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const symbolicateStackTrace = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');\n return symbolicateStackTrace(stack, extraData);\n }\n\n /**\n * Loads and returns the RN DevServer URL.\n */\n private _getDevServer(): ReactNative.DevServerInfo | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer');\n return getDevServer();\n } catch (_oO) {\n // We can't load devserver URL\n }\n return undefined;\n }\n}\n"]}
@@ -54,6 +54,10 @@ export declare class ReactNativeErrorHandlers implements Integration {
54
54
  * Handle errors
55
55
  */
56
56
  private _handleOnError;
57
+ /**
58
+ * Loads and returns rejection tracking module
59
+ */
60
+ private _loadRejectionTracking;
57
61
  }
58
62
  export {};
59
63
  //# sourceMappingURL=reactnativeerrorhandlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactnativeerrorhandlers.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA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AkC;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;IAcxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAoCxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAuC5B;;OAEG;IACH,OAAO,CAAC,cAAc;IAqEtB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAO/B"}
@@ -1,6 +1,7 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { getCurrentHub } from '@sentry/core';
3
3
  import { addExceptionMechanism, logger } from '@sentry/utils';
4
+ import { createSyntheticError, isErrorLike } from '../utils/error';
4
5
  import { RN_GLOBAL_OBJ } from '../utils/worldwide';
5
6
  /** ReactNativeErrorHandlers Integration */
6
7
  export class ReactNativeErrorHandlers {
@@ -63,7 +64,7 @@ export class ReactNativeErrorHandlers {
63
64
  * Attach the unhandled rejection handler
64
65
  */
65
66
  _attachUnhandledRejectionHandler() {
66
- const tracking = require('promise/setimmediate/rejection-tracking');
67
+ const tracking = this._loadRejectionTracking();
67
68
  const promiseRejectionTrackingOptions = {
68
69
  onUnhandled: (id, rejection = {}) => {
69
70
  // eslint-disable-next-line no-console
@@ -85,6 +86,7 @@ export class ReactNativeErrorHandlers {
85
86
  getCurrentHub().captureException(error, {
86
87
  data: { id },
87
88
  originalException: error,
89
+ syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),
88
90
  });
89
91
  },
90
92
  onHandled: (id) => {
@@ -187,6 +189,13 @@ export class ReactNativeErrorHandlers {
187
189
  }));
188
190
  }
189
191
  }
192
+ /**
193
+ * Loads and returns rejection tracking module
194
+ */
195
+ _loadRejectionTracking() {
196
+ // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies
197
+ return require('promise/setimmediate/rejection-tracking');
198
+ }
190
199
  }
191
200
  /**
192
201
  * @inheritDoc