From 308504ecb80f3a956ad962c34e4686c4376e7335 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 18 Jun 2026 17:21:35 +0200 Subject: [PATCH 1/2] fix(android): Accept RegularFile in Gradle bundle task path guards The Kotlin rewrite of the Gradle integration (sentry.gradle.kts) guarded bundle task path properties with `is Directory`, falling back to all-null otherwise. React Native's BundleHermesCTask declares `jsIntermediateSourceMapsDir` as a `RegularFileProperty`, so `.orNull` resolves to a `RegularFile`, the guard bails out, and source map upload is silently skipped with "Could not extract bundle task arguments". Accept both `Directory` and `RegularFile` in all three guards. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 6 ++++++ packages/core/sentry.gradle.kts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6220b7097..3c2ec9cfff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +### Fixes + +- Fix Android Gradle source map upload being silently skipped on some occasions ([#6319](https://github.com/getsentry/sentry-react-native/issues/6319)) + ## 8.15.0 ### Features diff --git a/packages/core/sentry.gradle.kts b/packages/core/sentry.gradle.kts index 4d8762ccd6..69ee83ca72 100644 --- a/packages/core/sentry.gradle.kts +++ b/packages/core/sentry.gradle.kts @@ -253,19 +253,25 @@ fun extractBundleTaskArguments( val jsSourceMapsDir = (props["jsSourceMapsDir"] as? org.gradle.api.provider.Provider<*>)?.orNull val jsIntermediateSourceMapsDir = (props["jsIntermediateSourceMapsDir"] as? org.gradle.api.provider.Provider<*>)?.orNull + // React Native's BundleHermesCTask declares `jsIntermediateSourceMapsDir` as a `RegularFileProperty` + // (and other versions may do the same for the bundle/sourcemap dirs) even though they hold a + // directory path, so accept both `Directory` and `RegularFile` here. val bundleDirFile = when (jsBundleDir) { is org.gradle.api.file.Directory -> jsBundleDir.asFile + is org.gradle.api.file.RegularFile -> jsBundleDir.asFile else -> return BundleTaskArgs(null, null, null, null) } val sourcemapsDirFile = when (jsSourceMapsDir) { is org.gradle.api.file.Directory -> jsSourceMapsDir.asFile + is org.gradle.api.file.RegularFile -> jsSourceMapsDir.asFile else -> return BundleTaskArgs(null, null, null, null) } 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) } From 6ebdc24d36563916b1af261e097dd9d95e538159 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Fri, 19 Jun 2026 09:40:40 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c2ec9cfff..55e567c1a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Fixes -- Fix Android Gradle source map upload being silently skipped on some occasions ([#6319](https://github.com/getsentry/sentry-react-native/issues/6319)) +- Fix Android Gradle source map upload being silently skipped on some occasions ([#6320](https://github.com/getsentry/sentry-react-native/pull/6320)) ## 8.15.0