Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry Plugin Does Not Run #380

Open
Keltin42 opened this issue Nov 27, 2023 · 6 comments
Open

Sentry Plugin Does Not Run #380

Keltin42 opened this issue Nov 27, 2023 · 6 comments

Comments

@Keltin42
Copy link

Summary

I followed the instructions here (https://docs.expo.dev/guides/using-sentry/) to setup sentry in my expo managed build. Sentry actually runs just fine in my dev environment, and I can see errors pop up on the sentry dashboard for my project, so that's all good.

Next step is getting the sourcemaps uploaded to sentry ... and that doesn't work at all. I've tried doing eas build for both iOS and Android, neither one uploads a sourcemap to sentry ... and in fact, if I look through the build logs I don't see any mention of it even trying to upload the sourcemaps to sentry ... so then I do a yarn expo prebuild --clean to rebuild my iOS and Android projects, and if I open that project up in XCode, I don't even see the "Upload Debug Symbols to Sentry" build phase ... it's not in the iOS project files. So it's no surprise that the eas build isn't producing creating or uploading sourcemaps.

As far as I can tell, the plugin isn't even running. There are error messages when I do the prebuild, it just succeeds as though everything is fine, but I don't think it is working at all. I'm stumped.

Is there something I'm doing wrong here?

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android, iOS

SDK Version (managed workflow only)

49

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.3.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.0.0 - ~/.nvm/versions/node/v18.0.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.0.0/bin/yarn
npm: 8.6.0 - ~/.nvm/versions/node/v18.0.0/bin/npm
Watchman: 2023.05.08.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.1 - /Users/tphilip/.rubies/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
npmPackages:
expo: ^49.0.0 => 49.0.6
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: ^0.72.6 => 0.72.6
react-native-web: ~0.19.6 => 0.19.7
npmGlobalPackages:
eas-cli: 5.9.1
Expo Workflow: bare

Reproducible demo or steps to reproduce from a blank project

It works correctly with a basic React Native project

If you create a brand new react native project using
npx react-native@latest init TestSentryConfig and then run the sentry wizard npx @sentry/wizard@latest -s -i reactNative, the iOS project is modified and definitely has the "Upload Debug Symbols to Sentry" build phase.

It does not work in a new Expo React Native project

If you create a new expo project npx create-expo-app my-expo-sentry-test-app and then install the sentry dependencies:

npx expo install sentry-expo
npx expo install expo-application expo-constants expo-device @sentry/react-native

and then run npm expo prebuild --clean and look at the iOS project file ... no build phase. No error messages, it all looks like it succeeds just fine, it just doesn't appear to have done anything.

@paule89123
Copy link

paule89123 commented Dec 3, 2023

I'm having the same issue. The documentation says that running expo publish should upload the sourcemaps, but at the end of running expo publish I get this:

Running postPublish hook: sentry-expo/upload-sourcemaps
Publish complete

📝  Manifest: [redacted]
⚙️   Project page: [redacted]

Error uploading sourcemaps to Sentry: spawn [redacted]
Verify that your Sentry configuration in app.json is correct and refer to https://docs.expo.io/versions/latest/guides/using-sentry.html

I've followed every step of the expo-sentry guide to the letter. My app.json is correctly configured in accordance with the guide:

{
  "expo": {
    // ...other stuff
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "[redacted]",
            "project": "[redacted]"
          }
        }
      ]
    }
  }
}

and I've configured SENTRY_AUTH_TOKEN in Eas Secrets. I can't see what I'm missing.

@rizikolik
Copy link

rizikolik commented Dec 6, 2023

similar issue happens for me, eas builds works fine, but locally :
eas build -p ios -e development:simulator --local fails and gives me this error :

PhaseScriptExecution Upload\ Debug\ Symbols\ to\ Sentry /var/folders/lb/jgxnlh1d4pn1_tpssgf3cv_00000gn/T/eas-build-local-nodejs/c92e7f9e-76d5-4878-9ad5-94f1da19c8da/build/ios/build/Build/Intermediates.noindex
And all of the configuration done with the help of expo docs.
hooks: {
postPublish: [
{
file: 'sentry-expo/upload-sourcemaps',
config: {
organization: process.env.EXPO_PUBLIC_SENTRY_ORG,
project: process.env.EXPO_PUBLIC_SENTRY_PROJECT,
},
},
],
},
plugins: [
'expo-apple-authentication',

'expo-calendar',
'expo-localization',
'@react-native-firebase/app',    'sentry-expo',

],
...

@Fgabz
Copy link

Fgabz commented Dec 13, 2023

Same problem. Is there a workaround to fix this? Having a project without a readable stacktrace is not the best dev experience....

@krystofwoldrich
Copy link
Contributor

Hello everyone,
@sentry/react-native now supports Expo out of the box!

You can upload source maps for EAS Update as easily as npx sentry-expo-upload-sourcemaps dist.
And native builds source maps uploads are now configured using @sentry/react-native/expo.

{
  "expo": {
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "https://sentry.io/",
          "warning": "DO NOT COMMIT YOUR AUTH TOKEN",
          "authToken": "Click to generate token",
          "project": "android",
          "organization": "demo"
        }
      ]
    ]
  }
}

Update to https://github.com/getsentry/sentry-react-native/releases/tag/5.16.0 or newer to get all the new features.

Migration guides available:

@timmyjose
Copy link

Hello everyone, @sentry/react-native now supports Expo out of the box!

You can upload source maps for EAS Update as easily as npx sentry-expo-upload-sourcemaps dist. And native builds source maps uploads are now configured using @sentry/react-native/expo.

{
  "expo": {
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "https://sentry.io/",
          "warning": "DO NOT COMMIT YOUR AUTH TOKEN",
          "authToken": "Click to generate token",
          "project": "android",
          "organization": "demo"
        }
      ]
    ]
  }
}

Update to https://github.com/getsentry/sentry-react-native/releases/tag/5.16.0 or newer to get all the new features.

Migration guides available:

* https://github.com/expo/fyi/blob/main/sentry-expo-migration.md

* https://docs.sentry.io/platforms/react-native/migration/sentry-expo/

@krystofwoldrich Does this work with expo SDK 49 though?

@zlanich
Copy link

zlanich commented May 12, 2024

Hey all! I got this to work. I found that even though I already have the SENTRY_AUTH_TOKEN in my eas.json, I still had to add the SENTRY_AUTH_TOKEN as a secret in Expo's EAS Cloud Dashboard as a secret in order for this to work, so there seems to be an issue with some variables in eas.json not being used in the build proces.

I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants