EAS Build fails when using Sentry + Bun
Build/Submit details page URL
https://expo.dev/accounts/ocho-co/projects/ocho-app/builds/b1370108-f846-4d85-8baf-701f6c69c35f
Summary
EAS Build fails when using sentry hooks. It looks like @sentry/cli dependency is not found when using Bun with EAS.
Managed or bare?
Managed
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.4.1
Shell: 5.8.1 - /opt/homebrew/bin/zsh
Binaries:
Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
Watchman: 2023.09.18.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK:
API Levels: 28, 30, 31, 32, 33
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.1, 34.0.0
System Images: android-30 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-34 | Google APIs ARM 64 v8a
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10406996
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
npmPackages:
expo: ~49.0.12 => 49.0.12
react: 18.2.0 => 18.2.0
react-native: 0.72.5 => 0.72.5
Expo Workflow: managed
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that packages match versions required by installed Expo SDK
Didn't find any issues with the project!
Error output
...
export XCODE_VERSION_MINOR\=1430
export XPCSERVICES_FOLDER_PATH\=OCHO.app/XPCServices
export YACC\=yacc
export _WRAPPER_CONTENTS_DIR_SHALLOW_BUNDLE_NO\=/Contents
export _WRAPPER_PARENT_PATH_SHALLOW_BUNDLE_NO\=/..
export _WRAPPER_RESOURCES_DIR_SHALLOW_BUNDLE_NO\=/Resources
export __IS_NOT_MACOS\=YES
export __IS_NOT_MACOS_macosx\=NO
export __IS_NOT_SIMULATOR\=YES
export __IS_NOT_SIMULATOR_simulator\=NO
export arch\=undefined_arch
export variant\=normal
/bin/sh -c /Users/expo/Library/Developer/Xcode/DerivedData/OCHO-asbycgoqcntopbfgrbdamjamarxt/Build/Intermediates.noindex/ArchiveIntermediates/OCHO/IntermediateBuildFilesPath/OCHO.build/Release-iphoneos/OCHO.build/Script-F33BB57CE98346A1ACF87612.sh
Error: spawn /Users/expo/workingdir/build/node_modules/@sentry/cli/sentry-cli ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:485:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /Users/expo/workingdir/build/node_modules/@sentry/cli/sentry-cli',
path: '/Users/expo/workingdir/build/node_modules/@sentry/cli/sentry-cli',
spawnargs: [
'debug-files',
'upload',
'--force-foreground',
'',
'/Users/expo/Library/Developer/Xcode/DerivedData/OCHO-asbycgoqcntopbfgrbdamjamarxt/Build/Intermediates.noindex/ArchiveIntermediates/OCHO/BuildProductsPath/Release-iphoneos'
]
}
Command PhaseScriptExecution failed with a nonzero exit code
Reproducible demo or steps to reproduce from a blank project
https://github.com/ocho-cesar/sentry-eas-error-bun
Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.
I can confirm there's a difference when installing the library via bun vs yarn. Not sure on the root cause yet. Both are installing @sentry/[email protected]:
bun install sentry-expo |
yarn add sentry-expo |
|---|---|
Tried this again with @sentry/cli directly and getting the same result.
Looks like this is an issue with bun not handling binary files defined in the package.json correctly. There is an open issue for over at the bun repo: https://github.com/oven-sh/bun/issues/2998
Closing this issue, as it is not something we can fix on eas-cli.
@ocho-cesar Maybe you could try working around this issue by adding trustedDependencies to your package.json, see my comment here.
Can confirm, @byCedric 's suggestion works! 👏 Note you have to remove your lockfile and node modules first which is why it didn't work for me when I tried this initially.
@ocho-cesar Maybe you could try working around this issue by adding
trustedDependenciesto your package.json, see my comment here.
Unfortunately it did not work for me :/
Could you double check you're doing this in the right order? I found it a bit unintuitive as well:
First, update your package.json to add:
"trustedDependencies": ["@sentry/cli"]
Second, remove node modules and the bun lockfile:
rm -rf node_modules
rm bun.lockb
Finally run install again
bun install
If it's working correctly you should see something like this after the install script:
This works for me locally but it does not work when running eas build
The problem is the version of bun that eas uses by default. If I set the bun version in eas.json to something higher (like 1.0.7) it will install the cli.
The problem is the version of bun that eas uses by default. If I set the bun version in eas.json to something higher (like 1.0.7) it will install the cli.
This worked for me for remote EAS builds. Thanks!