DataDog / expo-datadog

Datadog SDK for Expo
Apache License 2.0
9 stars 5 forks source link

unexpected argument 'react-native' found #18

Closed darnfish closed 11 months ago

darnfish commented 11 months ago

It looks like using the Expo build step alongside Sentry leads to a build failure.

This is the command in the build step:

export SOURCEMAP_FILE=$DERIVED_FILE_DIR/main.jsbundle.map
`node --print "require.resolve('@sentry/cli/package.json').slice(0, -13) + '/bin/sentry-cli'"` react-native xcode --force-foreground  ../node_modules/.bin/datadog-ci react-native xcode `"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"`

This is the command the step is producing:

/Users/darnfish/Developer/app/node_modules/@sentry/cli/bin/sentry-cli react-native xcode --force-foreground  ../node_modules/.bin/datadog-ci react-native xcode /Users/darnfish/Developer/app/node_modules/react-native/scripts/react-native-xcode.sh

This is the result of running the above command:

error: unexpected argument 'react-native' found

Usage: sentry-cli react-native xcode [OPTIONS] [BUILD_SCRIPT] [-- <ARGS>...]

For more information, try '--help'.

Looks like the error is originating from the transformation made here: https://github.com/DataDog/expo-datadog/blob/954fa235995245e4cd215c331b0f955e61fe7634/src/plugin/withIosSourcemaps/withIosSourcemaps.ts#L24

Any help here would be appreciated!

darnfish commented 11 months ago

Moving expo-datadog above sentry-expo in the plugins field of app.json / app.config.js seems to fix :~)

louiszawadzki commented 11 months ago

Hi @darnfish, thanks for reaching out!

I'll edit our docs to surface that information :)

By the way, did you have the opportunity to check that the sourcemaps were correctly uploaded to both platforms (i.e. errors appear with correct file names and lines)?

darnfish commented 11 months ago

@louiszawadzki Sentry sourcemaps were uploaded successfully, but I'm not sure where in Datadog to look for sourcemaps. Could you point me in the right direction? Thanks!

louiszawadzki commented 11 months ago

Hi @darnfish,

We currently don't have a UI showing the list of uploaded sourcemaps. For now the best you can do is to check any RUM error or Log error with a stacktrace for the version you've uploaded and see if the stacktrace is unminified.

You should probably also see a line mentioning it in the Expo build log.

Let me know if that helps!

darnfish commented 11 months ago

This is what I see in the EAS log:

› Executing App » Upload Debug Symbols to Sentry
› Executing App » Upload dSYMs to Datadog

Not sure if it was successful or not in terms of the content though

louiszawadzki commented 11 months ago

This means that iOS Debug symbols have been correctly uploaded, so that means your native iOS errors will be symbolicated correctly :)

If you want to check for RN sourcemaps, you can download the Xcode logs and look for Uploading sourcemap.

image

In one of my build here's the output I see:

Starting upload. 
Upload of /Users/expo/Library/Developer/Xcode/DerivedData/expo50beta-cicarqgraveydjggftmwmlvudzsm/Build/Intermediates.noindex/ArchiveIntermediates/expo50beta/IntermediateBuildFilesPath/expo50beta.build/Release-iphoneos/expo50beta.build/DerivedSources/main.jsbundle.map for bundle main.jsbundle on platform ios with project path /Users/expo/workingdir/build/ios
version: 2023.1215.0 build: 1 service: com.datadog.expo.sample
Please ensure you use the same values during SDK initialization to guarantee the success of the unminify process.
After upload is successful sourcemap files will be processed and ready to use within the next 5 minutes. 
⚠️ An error occured while invoking git: Error: fatal: not a git repository (or any of the parent directories): .git

Make sure the command is running within your git repository to fully leverage Datadog's git integration.
To ignore this warning use the --disable-git flag.
Uploading sourcemap /Users/expo/Library/Developer/Xcode/DerivedData/expo50beta-cicarqgraveydjggftmwmlvudzsm/Build/Intermediates.noindex/ArchiveIntermediates/expo50beta/IntermediateBuildFilesPath/expo50beta.build/Release-iphoneos/expo50beta.build/DerivedSources/main.jsbundle.map for JS file main.jsbundle

Command summary:
✅ Uploaded 1 sourcemap in 0.56 seconds.

Confirming the sourcemap was correctly uploaded.

darnfish commented 11 months ago

Seeing it on my end, thank you! Should be good to close this now :~)

louiszawadzki commented 11 months ago

Thanks! I'm closing the issue then :)