question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sentry-cli fails in yarn monorepo setup

See original GitHub issue

We 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
byCedriccommented, Nov 1, 2021

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 the cli.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 😄

2reactions
marandanetocommented, Nov 23, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspaces - Yarn
Workspaces are a new way to set up your package architecture that's available by default starting from Yarn 1.0. It allows you to...
Read more >
Yarn sentry. env. js through wizard with npx @sentry/wizard
Install @sentry/cli with yarn pnp; Run yarn run @sentry/cli; Expected Result. ... You probably already seen: sentry-cli fails in yarn monorepo setup ......
Read more >
NPM 7 workspace模式安装依赖执行找不到sentry-cli - 掘金
有个别都是yarn workspace说什么安装依赖异常, ... error: sentry-cli was not installed by @sentry/cli install script 复制代码 ...
Read more >
Installation | Sentry Documentation
Learn about the different methods available to install `sentry-cli`. ... generally when sentry-cli has been installed by a tool like homebrew or yarn, ......
Read more >
Scaling out JavaScript Monorepos with Yarn Workspaces
Monorepos and Yarn · Zero installs setups: dependencies are deduped and committed directly to the repository, making builds more reproducible and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found