Skip to content

feat: update sentry JS SDK to 10.x - #32

Open
edusperoni wants to merge 17 commits into
masterfrom
feat/js-sdk-update
Open

feat: update sentry JS SDK to 10.x#32
edusperoni wants to merge 17 commits into
masterfrom
feat/js-sdk-update

Conversation

@edusperoni

Copy link
Copy Markdown
Contributor

Still needs some testing and update the demo

@farfromrefug

Copy link
Copy Markdown
Member

@edusperoni i am very interested by this. Is it ready for review?

@edusperoni

Copy link
Copy Markdown
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.
@farfromrefug

Copy link
Copy Markdown
Member

@copilot describe the PR changes

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown

@copilot describe the PR changes

Here's a summary of the changes in this PR:

Core dependency update

  • Upgrades the Sentry JS SDK from v7/v8 to v10 (currently 10.70.0), adopting the new @sentry/core API (no more @sentry/types, hub replaced by scopes, etc.)

Native SDK updates

  • iOS: sentry-cocoa bumped to 9.19.1 — requires deployment target 15.0, drops the Obj-C NSSentry shim (PrivateSentrySDKOnly is now public Swift), maps enableNativeCrashHandlingenableCrashHandler, removes the no-longer-supported disabledNativeIntegrations option
  • Android: sentry-android bumped to 8.52.0 — uses ScopesAdapter instead of HubAdapter, AppStartMetrics instead of AppStartState, creates the outbox directory before writing envelopes (8.51 no longer auto-creates it), drops the self-assignment in the integrations copy

Scope sync

  • setAttribute/setAttributes/removeAttribute are now forwarded to the native scopes
  • Re-exports the new @sentry/core top-level helpers
  • Ports RN's primitiveTagIntegration/primitiveProcessor for tag stringification

Uncaught error handling

  • On NativeScript runtimes ≥ 9.1 the integration listens to the WHATWG error/unhandledrejection/rejectionhandled global events (which carry the thrown value + native exception) instead of the legacy Application events — uncaught errors no longer crash the app on these runtimes so the native crash handler would miss them
  • Late-handled rejections leave a breadcrumb; legacy runtimes keep the old Application wiring

New NativeException integration

  • On iOS: chains the ObjC throw-site frames from nativeException.callStackSymbols as a proper chained exception entry and attaches name/reason/domain/code/userInfo context
  • On Android: reads Throwable.getStackTrace() for native frames; attaches class/message context
  • Replaces the legacy regex re-parse of the runtime's combined JS+native stackTrace string

Non-Error / native-object capture improvements

  • Recognises NSError as a native exception on iOS (title from domain/localizedDescription)
  • Marshals native objects by their native .description instead of [object Object]
  • Unwraps ErrorEvent/PromiseRejectionEvent values; adopts name from duck-typed errors
  • Snapshots objects whose own properties are all non-enumerable so extra.capturedValue is not an empty object
  • Normalises non-Error values in client.eventFromException too (manual captureException)
  • Hints are now passed through to captureEvent so processors and attachments (e.g. screenshots) are not dropped

Bug fixes

  • Swapped value/key args in iOS setTagValueForKey/setExtraValueForKey corrected
  • Inverted zero-check in fetchNativeFrames fixed
  • App-start timestamp unit corrected
  • appHangsTimeoutInterval renamed to appHangTimeoutInterval (the misspelled key was silently ignored by sentry-cocoa)
  • patchGlobalPromise option and associated dead code removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants