feat: update sentry JS SDK to 10.x - #32
Open
edusperoni wants to merge 17 commits into
Open
Conversation
Member
|
@edusperoni i am very interested by this. Is it ready for review? |
Contributor
Author
|
Yes, I'm using it in prod |
Also ports the upstream 10.30->10.70 eventbuilder changes into the local copy.
…) and add scope attributes sync - iOS now requires deployment target 15.0 (sentry-cocoa 9 requirement) - Remove the NSSentry Obj-C shim: PrivateSentrySDKOnly is public in cocoa 9 and SentrySDK is a final Swift class, so call both directly - Options are built via PrivateSentrySDKOnly.optionsWithDictionary; the removed options.integrations list means disabledNativeIntegrations is no longer supported on iOS and enableNativeCrashHandling maps to enableCrashHandler - Android: sentry-android-gradle-plugin 6.18.0 (bundles 8.52.0), AppStartMetrics replaces the long-gone AppStartState, ScopesAdapter replaces HubAdapter, create the outbox dir before writing envelopes (8.51.0 no longer creates it), drop the packages/integrations copy that 8.x made a self-assignment - Regenerate both platform typings from the new SDKs - Sync scope attributes (setAttribute/setAttributes/removeAttribute) to the native scopes and re-export the @sentry/core top-level helpers - Port RN's primitiveTagIntegration/primitiveProcessor for tag stringification - Fix swapped value/key args in iOS setTagValueForKey/setExtraValueForKey, the inverted fetchNativeFrames zero-check, and the app start timestamp unit
Runtimes 9.1+ dispatch WHATWG error events on the global (error, unhandledrejection, rejectionhandled) carrying the actual thrown value, with nativeException/stackTrace attached. When available, the error handlers integration now listens to those instead of the legacy Application events and defaults to enabled — on these runtimes uncaught errors no longer crash the app, so the native crash handler would never report them. Late-handled rejections leave a breadcrumb. Legacy runtimes keep the previous Application wiring and defaults. nativeuncaughterror is deliberately not captured from JS: sentry-android's UncaughtExceptionHandlerIntegration already reports that crash natively.
… values - New NativeException default integration: on iOS it chains the ObjC throw-site frames from nativeException.callStackSymbols as a proper exception entry and attaches name/reason/domain/code/userInfo context; on Android it attaches class/message context (frames already come from the runtime's combined stackTrace when building the event) - Gate the client's NativeException entry to Android — parsing the combined stackTrace string only yields native frames there; on iOS it produced a junk entry while callStackSymbols went unused - toCapturableError normalizes uncaught/rejection values before capture: directly-thrown wrapped native exceptions (not Errors, no stack) become Errors carrying name/message with the native exception re-attached and the runtime's combined stackTrace preserved; other non-Error values get a groupable summary title with the raw payload kept as extra.capturedValue - Error handlers now pass their hint to captureEvent — previously the screenshot attachment was built onto the hint and then dropped, and event processors never saw the original exception
The runtimes' combined JS+native stackTrace error property is legacy. JS frames come from the error's own stack; native throw-site frames are now chained from the structured nativeException on both platforms — the NativeException integration reads Throwable.getStackTrace() on Android (works on all runtime versions) the same way it reads callStackSymbols on iOS. This removes the client's regex re-parse of the combined string, the stackTrace synthesis in wrapNativeException, and the stacktrace copies in the error handlers and toCapturableError.
- Recognize NSError as a native exception on iOS (title from domain/localizedDescription, existing domain/code/userInfo context) — rejected NSErrors previously fell into the opaque-object path - Title marshalled native objects by their native description instead of [object Object]; title other opaque objects by constructor name and getOwnPropertyNames (which sees the non-enumerable properties JSON misses) - Hide the wrapper machinery from wrapper stacks (captureStackTrace) so the culprit is the capture site, not wrapValue - Adopt name from duck-typed errors, extract an own-property Error when the value has no message of its own, and unwrap ErrorEvent / PromiseRejectionEvent instances passed as the captured value - Snapshot payloads whose own properties are all non-enumerable so extra.capturedValue is not an empty object - Normalize non-Error objects in client.eventFromException too (manual captureException) and attach extra.capturedValue; replaces wrapNativeException, which stamped nativeException onto every non-Error Android object, plain JS objects included
The option dictionary is forwarded verbatim to sentry-cocoa, whose key is appHangTimeoutInterval — the misspelled name was silently ignored, so the option never applied.
Member
|
@copilot describe the PR changes |
Here's a summary of the changes in this PR: Core dependency update
Native SDK updates
Scope sync
Uncaught error handling
New NativeException integration
Non-Error / native-object capture improvements
Bug fixes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still needs some testing and update the demo