DataDog / datadog-react-native-wizard

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

datadog-react-native-wizard` -> Xcode project file broken, Cannot read properties of undefined #22

Closed eric-everbright closed 1 year ago

eric-everbright commented 1 year 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. [ MY API KEY ]
? Select the site of your organization. US1
? Enter a custom intake URL if you use one. If you don't use one, just press enter. 
⚙️  Running task: add required dependencies.
⚙️  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/exs0di8/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:967:22)
    at pbxProject.addBuildPhase (/Users/exs0di8/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:874:37)
    at pbxProject.<anonymous> (/Users/exs0di8/.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:517:28)
    at pbxProject.<anonymous> (/Users/exs0di8/.npm/_npx/1ce2456bfb52c5c3/node_modules/xcode/lib/pbxProject.js:45:18)
    at ChildProcess.emit (node:events:517:28)
    at emit (node:internal/child_process:944: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.

Steps to reproduce the issue:


npx datadog-react-native-wizard
``` for a react native project

**Expected behaviour:**
succeeds

**Actual behaviour:**
fails

**Additional context**

- Node version
- v18.18.0

- react-native version
- 10.2.4
eric-everbright commented 1 year ago

Hmmm here's the change it's generating:

Screenshot 2023-10-03 at 7 46 13 PM
eric-everbright commented 1 year ago

I have the following in "bundle react native code and images":


# Fix for machines using nvm
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
. "$HOME/.nvm/nvm.sh"
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
. "$(brew --prefix nvm)/nvm.sh"
fi

export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh

I have to completely zero that out in order to get it to not fail, and then running the wizard replaces the contents with:

REACT_NATIVE_XCODE="./datadog-sourcemaps.sh"
export SOURCEMAP_FILE=$DERIVED_FILE_DIR/main.jsbundle.map
undefined
eric-everbright commented 1 year ago

Going to close. Had to go through the manual install steps for iOS.

louiszawadzki commented 1 year ago

Hi @eric-everbright, thanks for reaching out!

I'm glad you were able to resolve your issue with manual install steps, and we're interested in improving our support of React Native projects.

Could you specify which version of React Native you are using in your project? Your report mentions 10.2.4 so I assume there's a typo here.

Thanks a lot!