Skip to content

Reapply iOS SentrySDK.internal migration (#6380) after sentry-cocoa fixes screenshotSource lazy-var poisoning #6507

Closed

Description

@antonis

Follow-up to the revert in #6491 (which reverted #6380 to fix the iOS screenshot regression #6497).

Background

#6380 migrated iOS code from PrivateSentrySDKOnly to the new SentrySDK.internal Swift API. It shipped in 8.19.0 and broke all iOS screenshot capture (Feedback Widget screenshot, attachScreenshot, Sentry.captureScreenshot()) — see #6497. #6491 reverts #6380 as an interim fix.

Root cause (sentry-cocoa)

Any access to SentrySDK.internal constructs SentryInternalApi, whose init eagerly reads SentryDependencyContainer.screenshotSource. That property is a lazy var whose builder returns nil while startOptions is unset, and — being lazy — that nil is cached permanently. Because RN touches SentrySDK.internal before SentrySDK.start (from RNSentryStart and from JS integrations calling native methods like fetchNativeAppStart/fetchNativeSdkInfo during init), screenshotSource gets poisoned to nil and stays nil for the process lifetime.

A targeted RN-side fix is unreliable (any pre-start SentrySDK.internal access poisons it, and JS controls the timing), which is why we reverted the whole migration.

What needs to happen

  1. Fix in sentry-cocoa — screenshotSource (and the other startOptions-gated lazy providers, e.g. viewHierarchyProvider) must not permanently cache nil. Options:
    • Make screenshotSource a computed property instead of a lazy var so getOptionalLazyVar rebuilds it once startOptions is available; and/or
    • Have SentryInternalApi read the providers lazily at use-time rather than eagerly in init.
  2. Bump the sentry-cocoa dependency in RN to the fixed version.
  3. Reapply refactor(ios): Migrate from PrivateSentrySDKOnly to SentrySDK.internal #6380 (revert the revert), re-verifying the feedback E2E flow stays green on iOS.

Notes

Related: #6380, #6491, #6497

Activity

  1. linear-code commented on Jul 23, 2026

    @linear-code
  2. antonis commented on Jul 27, 2026

    @antonis
    ContributorAuthor

    Heads up that I've opened a PR for the cocoa fix getsentry/sentry-cocoa#8578

  3. self-assigned this
    on Jul 30, 2026
  4. added a commit that references this issue on Aug 3, 2026
    3d54bc6
  5. added a commit that references this issue on Aug 7, 2026
    443e7c9
  6. github-actions commented on Aug 13, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6541, which was included in the 8.23.0 release.

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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions