Skip to content

[Android] Gradle source map upload silently skipped on react-native 0.85 since 8.14.0 #6319

Description

@Joel-Mercier

What React Native libraries do you use?

Expo (mobile only), Expo Application Services (EAS), Expo Router, Hermes, RN New Architecture

Are you using sentry.io or on-premise?

sentry.io (SaS)

Are you using any other error monitoring solution alongside Sentry?

No

Other Error Monitoring Solution Name

No response

@sentry/react-native SDK Version

8.14.0

How does your development environment look like?

  - @sentry/react-native: 8.14.0 (also reproduces on 8.15.0, latest)
  - react-native: 0.85.3
  - expo: 56.0.12
  - Platform: Android, release build via eas build (cloud and --local)
  - Last working version: 8.13.0

Sentry.init()

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  enabled: !__DEV__ && process.env.EXPO_PUBLIC_ENV !== "development",
  environment: process.env.EXPO_PUBLIC_ENV ?? "development",
  release: `wavio@${Application.nativeApplicationVersion ?? "0.0.0"}`,
  dist: Application.nativeBuildVersion ?? undefined,
  sendDefaultPii: true,
  enableLogs: true,
  beforeBreadcrumb: (breadcrumb) => scrubBreadcrumb(breadcrumb),
  beforeSend: (event) => scrubEvent(event),
  ignoreErrors: [
    "Network Error",
    "timeout exceeded",
    "Request aborted",
    "AbortError",
    /ECONNABORTED/,
    /ERR_NETWORK/,
  ],
});

Steps to Reproduce

  1. Use a project on react-native 0.85.3 with @sentry/react-native@8.14.0, the @sentry/react-native/expo
    config plugin, and getSentryExpoConfig in metro.config.js (standard Expo setup; Debug IDs enabled).
  2. Ensure SENTRY_AUTH_TOKEN is available at build time so the Gradle auto-upload is eligible to run.
  3. Run a release Android build (eas build -p android --profile production, or any build that invokes the
    createBundleReleaseJsAndAssets task).
  4. Watch the Gradle output for the Sentry source-map upload step.

Expected Result

The Gradle integration extracts the bundle/source-map paths from the createBundleReleaseJsAndAssets
(BundleHermesCTask) task, runs sentry-cli sourcemaps upload, and an artifact bundle with a matching
Debug ID appears under Project → Settings → Source Maps. This is the behavior on 8.13.0 and earlier.

Actual Result

The build succeeds but the upload is silently skipped, with this warning:

  [sentry] Could not extract bundle task arguments for 'createBundleReleaseJsAndAssets'. Source maps will
  not be uploaded.

No artifact bundle is uploaded, so production stack traces are never symbolicated.

Root cause

8.14.0 rewrote the Gradle integration from sentry.gradle (Groovy) to sentry.gradle.kts (Kotlin) and
added a strict type guard in extractBundleTaskArguments (sentry.gradle.kts:266-270):

  val intermediateSourcemapsDirFile =
      when (jsIntermediateSourceMapsDir) {
          is org.gradle.api.file.Directory -> jsIntermediateSourceMapsDir.asFile
          else -> return BundleTaskArgs(null, null, null, null)   // ← bails out
      }

In RN 0.85, BundleHermesCTask declares jsIntermediateSourceMapsDir as a RegularFileProperty (used as a
directory — mkdirs() is called on it), not a DirectoryProperty. So .orNull returns a RegularFile, the is
Directory branch is skipped, and the else returns all-null → the caller logs the warning and skips
upload.

The old Groovy script (≤8.13.0) read the path dynamically
(props.jsIntermediateSourceMapsDir.get().asFile.absolutePath), which works regardless of the property's
static type — hence no regression there.

Suggested fix

Also accept RegularFile in the guard (safe, since RN populates it with a directory path):

       val intermediateSourcemapsDirFile =
           when (jsIntermediateSourceMapsDir) {
               is org.gradle.api.file.Directory -> jsIntermediateSourceMapsDir.asFile
  +            is org.gradle.api.file.RegularFile -> jsIntermediateSourceMapsDir.asFile
               else -> return BundleTaskArgs(null, null, null, null)
           }

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

Status
Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions