getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.56k stars 330 forks source link

docs: sentry-expo-upload-sourcemaps not found throubleshooting #3627

Open fobos531 opened 6 months ago

fobos531 commented 6 months ago

OS:

Platform:

SDK:

SDK version: 5.19.0

react-native version: 0.73.4

Are you using Expo?

Are you using sentry.io or on-premise?

Configuration:

(@sentry/react-native)

Sentry.init({
    dsn: process.env.SENTRY_DSN,
    enableWatchdogTerminationTracking: false,
    enableAppHangTracking: false,

    tracesSampleRate: 0.2,
    integrations: [
      new Sentry.ReactNativeTracing({
        tracingOrigins: ['localhost', /^\//, /^https:\/\//],
        routingInstrumentation,
      }),
    ],
    normalizeDepth: 10,
    attachScreenshot: true,
  });

I have the following issue: I can't seem to be able to use the npx sentry-expo-upload-sourcemaps dist command to upload the sourcemaps to Sentry.

Steps to reproduce:

Actual result:

➜ npx sentry-expo-upload-sourcemaps dist
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/sentry-expo-upload-sourcemaps - Not found
npm ERR! 404 
npm ERR! 404  'sentry-expo-upload-sourcemaps@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Additional error log output: CleanShot 2024-02-23 at 20 04 19@2x

Expected result:

I should be able to successfully upload sourcemaps to sentry.

kahest commented 6 months ago

Hi @fobos531 can you please clarify - which version of Expo are you using? Also, how did you install @sentry/react-native?

fobos531 commented 6 months ago

Hi @fobos531 can you please clarify - which version of Expo are you using? Also, how did you install @sentry/react-native?

Expo 50.0.7

I installed @sentry/react-native using their official instructions: https://docs.expo.dev/guides/using-sentry/

kahest commented 6 months ago

@fobos531 thank you for confirming! We're on it

krystofwoldrich commented 6 months ago

@fobos531 Could you share the exact steps you took and the version of the package manager you used?

I've tried the following, but was not able to reproduce the error:

  1. npx create-expo-app StickerSmash
  2. cd StickerSmash
  3. npx expo install @sentry/react-native
  4. npx sentry-expo-upload-sourcemaps dist
erikkodnar commented 6 months ago

Having a similar issue with a mono-repo project.

    "@sentry/cli": "^2.28.6",
    "@sentry/react-native": "5.19.1",
    "expo": "50.0.6",
    "react-native": "0.73.4",

Running npx sentry-expo-upload-sourcemaps dist after an eas update gives me a 404 not found in registry.

Side note: I've also tried directly running the sentry-expo-upload-sourcemaps script, but it fails to find the sentry-cli binary (failing to find the binary could be an issue related to the mono-repo structure of the project). When I set an environment variable that sets the location of the binary I get a "sourcemaps is not recognizable argument..." error.

fobos531 commented 6 months ago

Having a similar issue with a mono-repo project.

    "@sentry/cli": "^2.28.6",
    "@sentry/react-native": "5.19.1",
    "expo": "50.0.6",
    "react-native": "0.73.4",

Running npx sentry-expo-upload-sourcemaps dist after an eas update gives me a 404 not found in registry.

  • Using WSL Windows 11
  • GitHub actions.

Side note: I've also tried directly running the sentry-expo-upload-sourcemaps script, but it fails to find the sentry-cli binary (failing to find the binary could be an issue related to the mono-repo structure of the project). When I set an environment variable that sets the location of the binary I get a "sourcemaps is not recognizable argument..." error.

I have a similar setup. I am in a monorepo and my package manager is yarn v4.

erikkodnar commented 6 months ago

Having a similar issue with a mono-repo project.

    "@sentry/cli": "^2.28.6",
    "@sentry/react-native": "5.19.1",
    "expo": "50.0.6",
    "react-native": "0.73.4",

Running npx sentry-expo-upload-sourcemaps dist after an eas update gives me a 404 not found in registry.

  • Using WSL Windows 11
  • GitHub actions.

Side note: I've also tried directly running the sentry-expo-upload-sourcemaps script, but it fails to find the sentry-cli binary (failing to find the binary could be an issue related to the mono-repo structure of the project). When I set an environment variable that sets the location of the binary I get a "sourcemaps is not recognizable argument..." error.

I have a similar setup. I am in a monorepo and my package manager is yarn v4.

My repo is being managed by yarn v3.5, could be an issue with path resolutions 🤔.

krystofwoldrich commented 6 months ago

Thank @erikkodnar and @fobos531, we'll try to reproduce it with yarn v4 and monorepo setup.

krystofwoldrich commented 6 months ago

I tried https://docs.expo.dev/guides/monorepos/ with Yarn v4 and sadly still can't reproduce the issue.

@erikkodnar @fobos531 Would you be able to share an example project where the command doesn't work?

krystofwoldrich commented 6 months ago

@erikkodnar

I've also tried directly running the sentry-expo-upload-sourcemaps script, but it fails to find the sentry-cli binary (failing to > find the binary could be an issue related to the mono-repo structure of the project).

Could you share how you invoke the script and what path you set as sentry-cli binary?

knowbody commented 6 months ago

I was running into the same issue, but running:

yarn sentry-expo-upload-sourcemaps dist

works, as the script is part of the @sentry/react-native package in the node_modules.

you could also run:

node node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps dist
fobos531 commented 6 months ago

I was running into the same issue, but running:

yarn sentry-expo-upload-sourcemaps dist

works, as the script is part of the @sentry/react-native package in the node_modules.

you could also run:

node node_modules/@sentry/react-native/scripts/expo-upload-sourcemaps dist

I can confirm that this works for me as well.

krystofwoldrich commented 6 months ago

@knowbody Yes, that's a valid workaround.

The local bin is not resolved by the package manager. But from the current information, we are not able to determinate why.

Would anyone be able to share a reproducible example that we can debug?

knowbody commented 5 months ago

This happens to me on the codebase that has an expo app as part of the monorepo (yarn workspaces), I can try to put together some small repro in the end of the week.

krystofwoldrich commented 5 months ago

@knowbody Thank you.

233devs commented 5 months ago

Since npx executes commands directly from the npm registry, I think the problem is that the script cannot be found on the npm registry, hence the 404 Error. Can you verify if you can find the script on the registry on your end and we can go from there.

Screenshot 2024-03-14 at 12 18 42
krystofwoldrich commented 5 months ago

@233devs npx executes local bins first and then tries to fetch the package from the registry.

sentry-expo-upload-sourcemaps package doesn't exist. It's a binary that should be registered automatically when installing @sentry/react-native package.

krystofwoldrich commented 5 months ago

We should add troubleshooting note to docs and then we can close this issue.

knowbody commented 5 months ago

@krystofwoldrich sorry I didn't have time to create a repro. But I think changing the docs would be great and this could be closed