sentry-cli fails in yarn monorepo setup
See original GitHub issueWe have an expo app inside a yarn monorepo workspace and our build fails with:
> Task :app:bundleReleaseJsAndAssets
info Writing bundle output to:, /build/workingdir/build/apps/sh.hae.app/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /build/workingdir/build/apps/sh.hae.app/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 47 asset files
info Done copying assets
> Task :app:bundleReleaseJsAndAssets_SentryUpload_1 FAILED
> Task :app:bundleReleaseJsAndAssets_SentryUploadCleanUp SKIPPED
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
631 actionable tasks: 631 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets_SentryUpload_1'.
[stderr] > A problem occurred starting process 'command '/build/workingdir/build/apps/sh.hae.app/node_modules/@sentry/cli/bin/sentry-cli''
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 6m 57s
The call to /build/workingdir/build/apps/sh.hae.app/node_modules/@sentry/cli/bin/sentry-cli
fails because yarn installs @sentry/cli in the workspace root i.e. /build/workingdir/build/node_modules
not inside the apps/sh.hae.app
subdirectory.
This should be the culprit line:
https://github.com/getsentry/sentry-react-native/blob/b7b1372e637d2363a9d43811f332450735524212/sentry.gradle#L95
Expo uses require.resolve
within gradle to find package locations in yarn monorepos. e.g. new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
maybe this is a possible solution
(first reported to https://github.com/expo/sentry-expo/issues/217)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:16 (6 by maintainers)
Top GitHub Comments
Hi! My name is Cedric and I work for Expo, just want to pitch in and find some options to resolve this. With Expo SDK 43, one of the new focuses is adding support for monorepositories. I noticed the hardcoded path in the Gradle script as well. We can resolve this in
sentry-expo
by calculating thecli.executable
path, and if it’s different compared to this “hardcoded path”, we could add the relative location of the Sentry CLI.Is it safe to add that
cli.executable
path? As in, will this be supported for future versions? The documentation around this is fairly limited, so just want to check before we add this on our end 😄I’ve raised this issue https://github.com/getsentry/sentry-react-native/issues/1912 so iOS eventually respects the
cli.executable
config too instead of always hardcoded.