margelo / react-native-release-profiler

A fast and simple library to passively profile JS/Hermes performance in production and release builds.
https://margelo.io
MIT License
188 stars 2 forks source link

Processing performance trace on iOS fails with "Error: Android project not found" #2

Closed szpasztor closed 1 week ago

szpasztor commented 4 months ago

Overview Attempting to download and process the performance trace for a profiling session on iOS fails with the following output:

$ npx react-native-release-profiler --local /var/mobile/Containers/Data/Application/8BF1D060-684F-465A-820B-EE574FC6D99E/Library/Caches/profile-273CE684-52C0-416B-B6FB-BA67E9109D1C-7548-0000058188A57F98.cpuprofile
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside 'android' folder), consider setting `project.android.sourceDir` option to point to a new location.".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.17.0

Based on the error trace above, it appears that this is an internal error? The expected behavior here would be that no android files are required when using profiling on iOS only.

Reproduction steps:

  1. Install package according to README instructions and follow Usage section steps 2 through 4.
  2. Run step 5 for iOS: npx react-native-release-profiler --local <path to profile> with the profile path substituted

Dependencies:

"dependencies": {
    "expo": "^50.0.6",
    "react": "18.2.0",
    "react-native": "0.73.2",
    "react-native-release-profiler": "^0.1.6",
    ...
  }

Context: iOS 17.3 iPhone 14 pro max npx version 10.0.0

kirillzyusko commented 1 week ago

Hm, indeed

We rely that android project should be present, but if you use react-native only for iOS development, then most likely yes, you'll get the error.

I'll see if I can fix that 🙌