sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

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

Open fobos531 opened this issue 1 year ago • 19 comments

OS:

  • [ ] Windows
  • [X] MacOS
  • [ ] Linux

Platform:

  • [ ] iOS
  • [ ] Android

SDK:

  • [X] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 5.19.0

react-native version: 0.73.4

Are you using Expo?

  • [X] Yes
  • [ ] No

Are you using sentry.io or on-premise?

  • [X] sentry.io (SaaS)
  • [ ] 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:

  • install @sentry/react-native in an empty expo project
  • run npx sentry-expo-upload-sourcemaps dist

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.

fobos531 avatar Feb 23 '24 19:02 fobos531

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

kahest avatar Feb 27 '24 17:02 kahest

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/

fobos531 avatar Feb 27 '24 19:02 fobos531

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

kahest avatar Feb 28 '24 08:02 kahest

@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

krystofwoldrich avatar Feb 28 '24 10:02 krystofwoldrich

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.

erikkodnar avatar Feb 29 '24 20:02 erikkodnar

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.

fobos531 avatar Feb 29 '24 20:02 fobos531

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 🤔.

erikkodnar avatar Feb 29 '24 20:02 erikkodnar

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

krystofwoldrich avatar Mar 04 '24 08:03 krystofwoldrich

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 avatar Mar 04 '24 09:03 krystofwoldrich

@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?

krystofwoldrich avatar Mar 04 '24 09:03 krystofwoldrich

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

knowbody avatar Mar 05 '24 09:03 knowbody

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.

fobos531 avatar Mar 05 '24 14:03 fobos531

@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?

krystofwoldrich avatar Mar 05 '24 18:03 krystofwoldrich

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.

knowbody avatar Mar 12 '24 09:03 knowbody

@knowbody Thank you.

krystofwoldrich avatar Mar 13 '24 09:03 krystofwoldrich

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

233devs avatar Mar 14 '24 11:03 233devs

@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 avatar Mar 15 '24 12:03 krystofwoldrich

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

krystofwoldrich avatar Apr 05 '24 11:04 krystofwoldrich

@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

knowbody avatar Apr 05 '24 12:04 knowbody