bugsnag / bugsnag-expo Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I am encountering an error when generating a build with EAS:
eas build --profile preview --platform ios --local
The error message is:
[RUN_FASTLANE] ⚠️ Script has ambiguous dependencies causing it to run on every build.
To fix, go to: Xcode » [project] » Build Phases » 'Upload source maps to Bugsnag'
Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
"@bugsnag/expo": "^50.0.0",
"expo": "^50.0.14",
How fast bugsnag usually adds new expo SDK versions?
Add the plugin-expo-eas-sourcemaps
config plugin to an expo project in a monorepo. It does not work due to the node_modules
path not being what is expected in the scripts.
diff --git a/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh b/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh
index cc52c28..bce3d79 100755
--- a/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh
+++ b/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh
@@ -58,4 +58,4 @@ if [ ! -z "$ENDPOINT" ]; then
ARGS+=("$ENDPOINT")
fi
-../node_modules/.bin/bugsnag-source-maps upload-react-native "${ARGS[@]}"
+../../../node_modules/.bin/bugsnag-source-maps upload-react-native "${ARGS[@]}"
diff --git a/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/src/ios.js b/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/src/ios.js
index e18e9c8..b01bd40 100644
--- a/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/src/ios.js
+++ b/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/src/ios.js
@@ -31,7 +31,7 @@ function withIosPlugin (config, onPremConfig) {
bundleReactNativePhase.shellScript = modifiedScript
// 03. Configure the new build phase
- const shellScript = 'SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" ../node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh'
+ const shellScript = 'SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" ../../../node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh'
xcodeProject.addBuildPhase([], buildPhaseName, 'Upload source maps to Bugsnag', null, {
shellPath: '/bin/sh',
Hi, I'm added bugsnag to my project and I get the data from local testing, but when I "publish" my app through eas update
it crashes when the code reaches Bugsnag.start()
(I know it's this line cause I removed it and moved around to test it).
The biggest problem is that I don't know how to get any useful logs when it crashes, I tried to wrap in try catch but it didn't help. If you have an idea how to get the logs, I could try to resolve the issue myself.
I'm creating this issue to track support for Expo SDK 47 that is right around the corner (see here https://blog.expo.dev/expo-sdk-47-beta-is-now-available-fa760eea1908)
Bugsnag will block our upgrade to 47 until this is solved.
Edit: Tracking progress in #85
When I try to run EAS build on Android, I'm getting this error message.
`Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-7.5.1-all.zip
10%
20%.
30
%.
40%
50
%.
60%.
70%.
80%.
90
%.
100%
Welcome to Gradle 7.5.1!
Here are the highlights of this release:
Task :react-native-gradle-plugin:pluginDescriptors
Task :react-native-gradle-plugin:processResources
Task :react-native-gradle-plugin:compileKotlin
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (157, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (163, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (171, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (114, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with root to point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (27, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (130, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /home/expo/workingdir/build/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (251, 14): 'BaseVariant' is deprecated. Deprecated in Java
Task :react-native-gradle-plugin:compileJava NO-SOURCE
Task :react-native-gradle-plugin:classes
Task :react-native-gradle-plugin:inspectClassesForKotlinIC
Task :react-native-gradle-plugin:jar
[stderr]
FAILURE: Build failed with an exception.
[stderr]
Failed to apply plugin 'com.bugsnag.android.gradle'.
[stderr]
Using com.bugsnag.android.gradle:8+ with Android Gradle Plugin < 8 is not supported. Either upgrade the Android Gradle Plugin to 8, or use an earlier version of the BugSnag Gradle Plugin. For more information about this change, see https://docs.bugsnag.com/build-integrations/gradle/
[stderr]
Run with --stacktrace option to get the stack trace.
[stderr]
Run with --info or --debug option to get more log output.
[stderr]
Run with --scan to get full insights.
[stderr]
I tried removing bugsnag package from my project, and the build works.
I have also tried downgrading bugsnag package to version 44 ( this is my last project version before bumping up Expo SDK) and the build works.
It seems like expo build is on SDK 47 is using Gradle 7.5.1.
My project have these dependencies from bugsnag:
"@bugsnag/expo": "^47.0.0",
"@bugsnag/plugin-expo-eas-sourcemaps": "^47.0.0",
"@bugsnag/source-maps": "^2.3.1",
Im not sure to report to expo or bugsnag but since the error seems like caused by bugsnag specifically, I decided to report here instead.
In my app, I use an app version string that includes the git sha (such as 1.3.12-abcdef
), and I specify this explicitly when I . I do this to allow me to have a unique app version for each call to eas update
, and have separate source maps each time I publish. However, I am unable to configure the sourcemaps upload for a new build, so each build has an invalid version (until it receives an OTA update from eas update
).
Describe the solution you'd like
It would be great if the plugin could be configurable, so I can set a custom appVersion
for the sourcemap upload.
Describe alternatives you've considered
To work around this, I am modifying my app.json file during my CI step to inject the expo.version
that I want the sourcemaps to be published with.
expo-bugsnag v51.x added expo-secure-store
as peer-depedency. This package doesn't work on the web platform and causes the app to crash on runtime.
A possible fix would be to use AsynStorage
when running in the web platform.
Uncaught TypeError: _ExpoSecureStore.default.getValueWithKeySync is not a function
SDK 49 is soon out, so I have created this issue to track the SDK 49 support
Modern expos allow using app.config.js rather than app.json.
If app.json is missing, or is missing an "expo": {}
element, the init command fails:
zumthor$ npx bugsnag-expo-cli init
✔ @bugsnag/expo already appears to be installed, do you want to install it and its dependencies anyway? … no
✔ What is your Bugsnag API key? … deadbeef4acab110b32b3a1234567890
> Inserting API key into app.json
TypeError: Cannot read properties of undefined (reading 'extra')
at module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/lib/set-api-key.js:9:33)
at async module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/commands/set-api-key.js:18:15)
at async module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/commands/init.js:11:3)
at async go (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/cli.js:39:21)
echo '{ "expo": {} }' > app.json
It will also die if the app.json lacks an expo
field: i.e. app.json == {}
yields sadness, app.json = { "expo": {} }
yields workaround.
Vanilla repo, change to dynamic config:
cd /tmp
expo init foo -t blank
cd foo
# (will attest that the config hasn't changed)
npx expo config --json | jq '. | del(._internal) | { expo: . }' > cfg-vanilla.json
( echo -n "const AppConfig = (" ; cat app.json ; echo ")" ; echo "export default AppConfig" ) > app.config.js
mv app.json away-app.json
npx expo config --json | jq '. | del(._internal) | { expo: . }' > cfg-dynamic.json
# this will be empty, the configs are the same
diff cfg-dynamic.json cfg-vanilla.json
quickbeam main /tmp/foo$ npx bugsnag-expo-cli init
✔ @bugsnag/expo does not appear to be installed, do you want to install it and its dependencies? … yes
✔ If you want to install @bugsnag/expo ^46.0.0 hit enter, otherwise type the version you want … ^46.0.0
> Installing @bugsnag/expo. This could take a while!
✔ What is your Bugsnag API key? … deadbeef4acab110b32b3a1234567890
> Inserting API key into app.json
Error: Couldn’t find app.json in "/private/tmp/foo". ....
/tmp/foo$ echo '{ "expo": {} }' > app.json
/tmp/foo$ npx bugsnag-expo-cli init
/tmp/foo$ cat app.json
... then replay the changes from app.json into your config file.
TypeError: Cannot read properties of undefined (reading 'extra')
at module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/lib/set-api-key.js:9:33)
at async module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/commands/set-api-key.js:18:15)
at async module.exports (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/commands/init.js:11:3)
at async go (/Users/flip/.npm/_npx/c6a5a58d15e1cf59/node_modules/bugsnag-expo-cli/cli.js:39:21)
Before all, thanks for working on the lib!
When I trigger a native crash, I don't see it reported on BugSnag.
Here's how I triggered a native crash:
onPress
callback@throw [NSException exceptionWithName:@"IntentionalCrashException"
/ On Android, throw new RuntimeException("This crash is intentional for testing purposes");
I'm using a managed workflow on expo, using expo prebuild
to generate iOS and Android folder locally (and EAS build in CD).
There might be something wrong: when I open the generated AppDelegate
, I don't see any [Bugsnag start]
in the didFinishLaunchingWithOptions
- as seen in the classical BugSnag React Native guide: https://docs.bugsnag.com/platforms/react-native/react-native/manual-setup/#app-delegate
I can't find Bugsnag pod either.
Because BugSnag is not natively started, I understand I don't see native reports.
Same on Android : opening MainApplication.kt
, I don't see Bugsnag.start(this)
in the onCreate
function.
Did I miss something in the setup, or does the expo bugsnag plugin only works for JS errors? (which does work well on my project)
After submitting a built to EAS:
› Executing Flowchase » Upload source maps to Bugsnag
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ PhaseScriptExecution Upload\ source\ maps\ to\ Bugsnag /Users/expo/Library/Developer/Xcode/DerivedData/Flowchase-dqtytsgkfadtwteridyhlzhrlmyt/Build/Intermediates.noindex/ArchiveIntermediates/Flowchase/IntermediateBuildFilesPath/Flowchase.build/Release-iphoneos/Flowchase.build/Script-026EE93FE26B4D48B5B4D384.sh (in target 'Flowchase' from project 'Flowchase')
To be clear: this causes an iOS build to fail.
Let me know if there's any extra info I can provide, I'd like to help :)
???
@bugsnag/plugin-expo-eas-sourcemaps
: 46.0.0› Executing Flowchase » Upload source maps to Bugsnag
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ PhaseScriptExecution Upload\ source\ maps\ to\ Bugsnag /Users/expo/Library/Developer/Xcode/DerivedData/Flowchase-dqtytsgkfadtwteridyhlzhrlmyt/Build/Intermediates.noindex/ArchiveIntermediates/Flowchase/IntermediateBuildFilesPath/Flowchase.build/Release-iphoneos/Flowchase.build/Script-026EE93FE26B4D48B5B4D384.sh (in target 'Flowchase' from project 'Flowchase')
After the update, We get this error:
in fastlane step: send_build_to_bugsnag
[12:40:16]: A Bugsnag API key is required to release a build. Set com.bugsnag.android.API_KEY in your AndroidManifest.xml to detect API key automatically.
it was working before the upgrade.
I think if this meta-info is need, it should be add by the plugin in the pre-build step instead of us doing it.
I had to push a quick bug fix via EAS Update but now the source maps no longer work - or at least another runtime exception logged after the update does not have the sources mapped.
Describe the solution you'd like
When one runs
eas update --branch production --message 'Updating the app'
upload the source maps.
I'm using expo with @bugsnag/plugin-expo-eas-sourcemaps. After eas build iOS sourcemaps are uploaded but nothing about Android. Also bugsnag logs not present in EAS Build logs.
Hello,
I saw this failure in my EAS android build:
$ npx bugsnag-eas-build-on-success
Error: Failed to load app.json file /home/expo/workingdir/build/app.json.
Error: Cannot find module '/home/expo/workingdir/build/app.json'
Require stack:
- /home/expo/workingdir/build/node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/eas-build-on-success.js
I believe it's because my Expo app uses app.config.ts
instead of app.json
. I noticed the eas-build-on-success.js
file only looks for app.json
:
let appConfig, apiKey
try {
appConfig = require(`${PROJECT_ROOT}/app.json`)
apiKey = appConfig?.expo?.extra?.bugsnag?.apiKey
} catch (error) {
console.error(`Error: Failed to load app.json file ${PROJECT_ROOT}/app.json.\n${error}`)
exit(1)
}
It should also look for app.config.ts
or app.config.js
, the same way that Expo does.
app.json
to app.config.js
npx bugsnag-eas-build-on-success
Per the title, is bugsnag-expo configured to compile full react-native support with expo-dev-client to capture native android/ios errors? Or is it a JS only package at this point?
bugsnag-expo/packages/plugin-expo-eas-sourcemaps/src/android.js
Lines 54 to 56 in c37c324
I don't think :[7.3.0,)
is valid gradle groovy syntax for a classpath version specifier, is it?
Running EAS build I am getting the following error if I install react native netinfo 8.3.0
[stderr] warning "@bugsnag/expo > @bugsnag/[email protected]" has incorrect peer dependency "@react-native-community/[email protected]".
[stderr] warning "@bugsnag/expo > @bugsnag/[email protected]" has incorrect peer dependency "@react-native-community/[email protected]".
Describe the solution you'd like
Support package versions in the same minor range
Expo prebuild:
Build start failing because of the latest android gradle plugin is not versioned.
apply plugin: 'com.bugsnag.android.gradle'
bugsnag {
uploadReactNativeMappings = true
}
The latest release here is gradle 8: https://github.com/bugsnag/bugsnag-android-gradle-plugin/releases
The build error.
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.bugsnag.android.gradle'.
Using com.bugsnag.android.gradle:8+ with Android Gradle Plugin < 8 is not supported. Either upgrade the Android Gradle Plugin to 8, or use an earlier version of the BugSnag Gradle Plugin. For more information about this change, see https://docs.bugsnag.com/build-integrations/gradle/
On new build updates with "expo publish", the reported bugs do not have the right source map configurations.
I went ahead and looked into what changed since this used to work before v48.
I believe the culprit is a731586
This change removes setting the right codeBundleId
on the bugsnag notifier. It seems premature to do so since expo publish
is still around, and bugsnag still doesn't officially support eas update
.
Currently it appears to not be possible to upload sourcemaps conditionally for iOS.
Maybe the right question is "Why is there different logic for Android and IOS source map upload trigger?"
With Android it is possible via eas-build-on-success hook. Example:
package.json
"eas-build-on-success": "./eas-build-on-success.sh"
eas-build-on-success.sh
#!/bin/bash
if [[ "$EAS_BUILD_PROFILE" == "production" ]]; then
echo "Production profile detected."
npx bugsnag-eas-build-on-success
else
echo "Non-production profile detected. Skipping hook."
fi
Due to iOS not using this hook I cannot control the conditions for publishing release & uploading sourcemaps.
Let's harmonize the logic?
trying to integrate sentry
at the same time as we have bugsnag
works fine. we notice that The @bugsnag/plugin-expo-eas-sourcemaps
isn't too friendly to other scripts.
Having this order in app.config.ts
plugins: [
...
'@bugsnag/plugin-expo-eas-sourcemaps',
'sentry-expo',
...
]
Will generate this issue
PhaseScriptExecution Upload\ source\ maps\ to\ Bugsnag /Users/expo/Library/Developer/Xcode/DerivedData/projectName/Build/Intermediates.noindex/ArchiveIntermediates/projectName/IntermediateBuildFilesPath/projectName.build/Release-iphoneos/projectName.build/Script.sh (in target 'projectName' from project 'projectName')
changing the order works fine
plugins: [
...
'sentry-expo',
'@bugsnag/plugin-expo-eas-sourcemaps',
...
]
Setup Sentry
and Bugsnag
in same project outing the plugins in the order mentioned above.
A clear and concise description of what the bug is.
I'm running into an error which says "Can't read manifest of undefined" when running tests. I do have a mock in place but i guess the issue lies within bugsnag-expo
For some weird reason, Constants appear as undefined here
bugsnag-expo/packages/expo/src/config.js
Line 12 in 2189984
Please do note that i have a mock function which mocks the expo constants as well
# (Insert code sample to reproduce the problem)
TypeError: Cannot read property 'manifest' of undefined
at Object.<anonymous> (node_modules/@bugsnag/expo/src/config.js:12:15)
at Object.<anonymous> (node_modules/@bugsnag/expo/src/notifier.js:17:64)
This might be the possible fix :
expo/eas-cli#1265 (comment)
If yes, please implement it and publish it in a next release so i could use it
After upgrade @bugsnag/expo
to 49.0.0
this error manifest on a standalone app.
I saw in the code base on the lib, and i think that the problem is here
developer
is not a key of Constants.expoConfig
object.
@bugsnag/expo
to 49.0.0
TypeError: Cannot read property 'developer' of null
Expo SDK 51 has been released as of May 7th 2024, hope to have this new version in order to be able to update to the new react native architecture in my projects.
Would be nice to now the time estimate to have this update in case that I need to remove bugsnag dependency for the time being in order to update the SDK to the latest.
Additional context
Describe the solution you'd like
Should work with SDK 48
https://medium.com/the-exponent-log/expo-sdk-48-ccb8302e231
SDK 45 is released and it is currently not supported
Describe the solution you'd like
SDK 45 should be supported
Describe alternatives you've considered
Additional context
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.