Closed wcastand closed 5 months ago
Hi @wcastand, thanks for reaching out!
expo-datadog
versions are tied to a specific Expo SDK version since with for major Expo SDK version the sourcemaps generation might be working differently, so you should use version 49.0.1
if you are on Expo 49.
The error message you get means that the path to the mobile-app/node_modules/.bin/datadog-ci
file is incorrect. This is what the patch is supposed to fix, and it's probably not applied since you are using a different expo-datadog
version that the one the patch was made for.
Can you check if it's applied locally?
If not, I would recommend you to switch to expo-datadog
version 49.0.1
and check again if the patch is applied.
will keep you inform but looks like i fixed the version and the path, now for some reason he says i don't have a valid api_key when it's the one from datadog application setup. So must have missed something.
if i still can't build after fixing this env thing, i'll comeback to you with hopefully more info :)
EDIT: i don't get why i check by console.log what the api key the script receive and it's the one from the datadog setup RUM page, but it sayds it's invalid so not sure what is happening
Hi @wcastand,
You indeed need to specify an API key to upload the sourcemaps to Datadog. We recommend to run eas secret:create
to set DATADOG_API_KEY
to your Datadog API key.
Note: This is an API key, which is different from the RUM application id. You can check our docs on how to get an API key.
If you have already done that and your key is still invalid, I would recommend you to reach out to our support team so they can have a look into what's wrong here.
hmm ok let me try but that's quite confusing :/ between the API KEY , APP ID and API KEY for uploading should probably also add the expo version needs to be a match to the datadog package version because i don't remember seeing it mentioned(unless i missed it of course then my bad)
same for the patch for monorepo, it should probably be in the docs, a lot of expo app are on monorepo as far as i know.
let me try to setup that then
I think i fixed ios build but android is still failing on the sourcemaps
[RUN_GRADLEW] > Task :app:uploadReleaseSourcemaps FAILED
[RUN_GRADLEW] Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
[RUN_GRADLEW] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[RUN_GRADLEW] Exception raised during command execution, stderr=, stdout=
[RUN_GRADLEW] FAILURE: Build failed with an exception.
[RUN_GRADLEW] * What went wrong:
[RUN_GRADLEW] Execution failed for task ':app:uploadReleaseSourcemaps'.
[RUN_GRADLEW] > A problem occurred starting process 'command '/private/var/folders/rz/_g_4f1k95bl68ld6_tjj4wt40000gn/T/eas-build-local-nodejs/08d11e9f-3642-40c1-9cbe-0a27c848205b/build/apps/mobile-app/node_modules/.bin/datadog-ci''
i don't know if it's the monorepo setup again that make the path fail. i can't find where yo modify the path since it's dynamic with
`apply plugin: "com.facebook.react"\napply from: "${require("path").dirname(
require.resolve("@datadog/mobile-react-native/package.json")
)}/datadog-sourcemaps.gradle"`
and it looks like the issue is maybe in the datadog-ci cli and not the expo-datadog this time but not sure.
looks like it's looking for datadog-ci in mobile-app/node_modules
instead of ../../node_modules
from what i see the issue is in
@datadog/mobile-react-native/datadog-sourcemaps.gradle
def execCommand = { jsBundleFile ->
return [
"$reactConfig.root/node_modules/.bin/datadog-ci",
"react-native",
"upload",
"--platform",
"android",
"--service",
serviceName,
"--bundle",
jsBundleFile.absolutePath,
"--sourcemap",
jsOutputSourceMapFile.absolutePath,
"--release-version",
releaseVersion,
"--build-version",
buildVersion
]
}
looks like $reactConfig.root
is coming from getReactConfig
which use
reactConfig['root'] = project.extensions.react.root.get() ?: "../../"
but it seems to return the wrong path, getting : /build/apps/mobile-app/node_modules/.bin/datadog-ci''
instead of /build/node_modules/.bin/datadog-ci''
looking at how sentry is doing it, in the plugin for expo they add a their cli path as a project.ext to get the right absolute path it seems.
in my bbuild.gradle generated by expo i have this from sentry-expo
project.ext.sentryCli=[collectModulesScript: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../dist/js/tools/collectModules.js")]
which i assumed give the right path to use for the script later on when it comes to uploading sourcemaps in android. maybe you need to do something similar to handle monorepo in android expo app
Hi @wcastand, thanks for taking the time to investigate into this, I think what you describe is very likely the root cause.
I believe we should handle monorepo setups for Expo apps better, I'll bump the priority for this in our backlog. The approach from Sentry seems like a good one indeed, thanks for looking into it!
However we likely won't have the bandwidth to prioritize this straight away, so to get you unblocked in the meantime, can you try to apply this patch to @datadog/mobile-react-native
as @datadog+mobile-react-native+2.2.0.patch
?
diff --git a/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle b/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
index 8d61d71..c4e29e1 100644
--- a/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
+++ b/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
@@ -57,7 +57,7 @@ afterEvaluate {
def execCommand = { jsBundleFile ->
return [
- "$reactConfig.root/node_modules/.bin/datadog-ci",
+ "$reactConfig.root/../../node_modules/.bin/datadog-ci",
"react-native",
"upload",
"--platform",
Let me know if that unblocks you, that would also validate the root cause of the issue at the same time :)
@louiszawadzki i can confirm, this fixes the issue on eas, i managed to build without fail once i made the patch.
worth noting just in case, for ios the path change was a bit different than the one you proposed in the other issue for me it was
../../../node_modules
and not ../../node_modules
because there is the ios
folder too in that case.
so it would depend on people setup for sure, can't be an constant or absolute value anymore if you want to handle monorepos
Ran into the exact same issue and confirmed it was fixed by a similar patch, although my directory structure was slightly different from @wcastand 's. We use yarn workspaces, and recently upgraded from yarn classic to yarn berry. It looks like the .bin/datadog-ci
script was being hoisted into the root node_modules
rather than the workspace's node_modules
.
It seems like a long-term fix needs to be smart enough to traverse up the workspace tree to figure out where to find the datadog-ci
binary. For yarn users, you could run yarn bin datadog-ci
which prints out the absolute path to the binary, but this probably wouldn't work for pnpm or other package managers.
Edit: unfortunately am running into a similar issue for iOS, trying to find the same place where it's being modified:
/Users/expo/Library/Developer/Xcode/DerivedData/<MyProject>/Build/Intermediates.noindex/ArchiveIntermediates/<MyProject>/IntermediateBuildFilesPath/<MyProject>.build/Release-iphoneos/<MyProject>.build/Script-00DD1BFF1BD5951E006B06BC.sh: line 41: ../node_modules/.bin/datadog-ci: No such file or directory
Hi @navignaw
Sorry for the long wait!
We are addressing the issue in this PR: https://github.com/DataDog/expo-datadog/pull/38
I'm using expo sdk 49 my build fails on android and ios as soon as i try to add
expo-datadog
I'm in a monorepo so according to the issue about monorepo i added the patch. #17datadog works fine if i don't add expo-datadog or set to false the sourcemaps, dSym config options.
On ios it complains avec about minimum version being set to ios 11 when most dependencies and expo itself only support minimum version of 12 or 13.
It looks like i can build the app if i set to false all the sourcemaps and dSym config. On android, i can build locally for dev but on
eas
it fails.i tried to use
expo-build-properties
to force :but it didn't help no matter the order of the plugins.
Expo SDK: 49
"@datadog/mobile-react-native": "^2.2.0", "expo-datadog": "^50.2.0", "@datadog/datadog-ci": "^2.32.0",
on android the error is
ios logs (they are so long they don't git into my terminal history so i just grabed the last bit, if you need more let me know but it's like really long)