DataDog / datadog-react-native-wizard

Setup wizard for Datadog React Native SDK
Apache License 2.0
4 stars 2 forks source link

Multiple errors when running the wizard #29

Closed dansimau closed 4 days ago

dansimau commented 7 months ago

Describe what happened

$ npx datadog-react-native-wizard
Starting command: Setup the automated upload of javascript sourcemaps to Datadog
⚙️  Running task: get sourcemaps upload variables.
? Enter your apiKey. You can find one in your organization settings. xxxxxxxxxxxxx
? Select the site of your organization. US5
? Enter a custom intake URL if you use one. If you don't use one, just press enter.
⚙️  Running task: add required dependencies.
yarn add v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[...]
[4/4] Building fresh packages...
success Saved lockfile.
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
success Saved 102 new dependencies.
[...]
Done in 17.95s.
⚙️  Running task: automate sourcemaps upload on iOS builds.
⚙️  Running task: automate sourcemaps upload on Android builds.
⚙️  Running task: automate dSYMs upload on iOS builds.
TypeError: Cannot read properties of undefined (reading 'project')
    at pbxProject.pbxFileReferenceSection (/Users/dan/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:967:22)
    at pbxProject.addBuildPhase (/Users/dan/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:874:37)
    at pbxProject.<anonymous> (/Users/dan/.npm/_npx/1ce2456bfb52c5c3/node_modules/datadog-react-native-wizard/dist/commands/setup/add-xcode-dsyms-build-phase/inject-dsyms-build-phase.js:22:26)
    at pbxProject.emit (node:events:514:28)
    at pbxProject.<anonymous> (/Users/dan/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:45:18)
    at ChildProcess.emit (node:events:514:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
❌ Error encountered while running automate dSYMs upload on iOS builds step.
We could not setup a new build phase in XCode to automatically upload dSYMs files after each iOS build.
If you want to symbolicate native crashes, add a New Run Script Phase inside your project build phases and add the following script to it:

/opt/homebrew/bin/node /opt/homebrew/bin/yarn datadog-ci dsyms upload $DWARF_DSYM_FOLDER_PATH
Expected "/*" but "}" found.
⚙️  Running task: automate proguard mapping files upload on android builds.
? Have you enabled Android minification and obfuscation (see
? Have you enabled Android minification and obfuscation (see
https://reactnative.dev/docs/signed-apk-android#enabling-proguard-to-reduce-the-size-of-the-apk-optional)?
If you have it enabled, (cd android && ./gradlew tasks --all) | grep minifyReleaseWithR8 should return app:minifyReleaseWithR8 No

Finished running command Setup the automated upload of javascript sourcemaps to Datadog

✅ Successfully executed: get sourcemaps upload variables.
✅ Successfully executed: add required dependencies.
✅ Successfully executed: automate sourcemaps upload on iOS builds.
✅ Successfully executed: automate sourcemaps upload on Android builds.
❌ Error encountered while running automate dSYMs upload on iOS builds step.
We could not setup a new build phase in XCode to automatically upload dSYMs files after each iOS build.
If you want to symbolicate native crashes, add a New Run Script Phase inside your project build phases and add the following script to it:

/opt/homebrew/bin/node /opt/homebrew/bin/yarn datadog-ci dsyms upload $DWARF_DSYM_FOLDER_PATH
Expected "/*" but "}" found.✅ Successfully executed: automate proguard mapping files upload on android builds.

Keep in mind that this tool is brand new. Check your git changes before committing them.
If you have any issue, please go to https://github.com/DataDog/datadog-react-native-wizard/issues

The end result was very much invalid. Here is a diff of our xcode project file:

@@ -476,7 +476,7 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
+                       shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";REACT_NATIVE_XCODE=\"./datadog-sourcemaps.sh\"\nexport SOURCEMAP_FILE=$DERIVED_FILE_DIR/main.jsbundle.map\nundefined
                };
                01B5A939A042D32E7BA0EE16 /* [CP] Copy Pods Resources */ = {
                        isa = PBXShellScriptBuildPhase;

The sourcemap file has "undefined" on the end, which seems wrong.

There are multiple errors in the output, e.g.:

Are there manual instructions on how to set this up?

dansimau commented 7 months ago

Answering my own question...

Are there manual instructions on how to set this up?

Yes, here: https://docs.datadoghq.com/real_user_monitoring/error_tracking/mobile/reactnative/#alternatives-to-datadog-react-native-wizard