expo / sentry-expo

MIT License
202 stars 83 forks source link

Sentry not working SDK 47 #305

Closed rauldeheer closed 1 year ago

rauldeheer commented 1 year ago

Summary

I'm setting up Sentry just as it is described in the documentation here, but my Sentry dashboard remains empty when I submit an intentional error. I'm not getting any errors or warnings except for this one:

» android: sentry-expo: Missing Sentry configuration properties: organization, project, authToken from app.json. Builds will fall back to environment variables. Refer to @sentry/react-native docs for how to configure this.
» ios: sentry-expo: Missing Sentry configuration properties: organization, project, authToken from app.json. Builds will fall back to environment variables. Refer to @sentry/react-native docs for how to configure this.

Because I've intentionally used the environment variables as described in the docs.

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)

47.0.8

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.0 Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.1.1 - ~/.nvm/versions/node/v18.12.0/bin/npm IDEs: Xcode: /undefined - /usr/bin/xcodebuild npmPackages: expo: ~47.0.8 => 47.0.8 react: 18.1.0 => 18.1.0 react-native: 0.70.5 => 0.70.5 npmGlobalPackages: eas-cli: 2.8.0 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

I've followed the exact steps as described in the docs. So:

App.tsx:

import * as Sentry from "sentry-expo";

ENVIRONMENT === "production" &&
  Sentry.init({
    dsn: SENTRY_DSN,
    debug: DEBUG,
    enableInExpoDevelopment: true,
    tracesSampleRate: 1
  });

Then I create an error and capture it manually:

AnyFile.tsx:

import * as Sentry from "sentry-expo";

try {
  throw new Error("Lol!");
} catch (error) {
  console.log(Sentry.Native.captureException(error));
  Sentry.Native.nativeCrash();
}

As you can see I'm actually logging the eventId that Sentry supposedly makes, according to the js-docs. I'm receiving an ID as expected.

rauldeheer commented 1 year ago

I downgraded sentry-expo to version 4.2.0 and everything works now.

hiddenist commented 1 year ago

Is this a duplicate of #285?

zivc commented 1 year ago

I'm on Expo 47 and did the following;

npm uninstall @sentry/react-native --save
npm install sentry-expo@4.2.0 --save

And then in my App.js I have the following:

import * as Sentry from "sentry-expo";
import { CaptureConsole } from "@sentry/integrations";

LogBox.ignoreLogs(["Sentry Logger [warn]: Session tracking in non-browser environment with @sentry/browser is not supported."]);

Sentry.Browser.init({
    dsn: Constants.expoConfig.extra.sentry.dsn,
    enableInExpoDevelopment: true,
    debug: !!__DEV__,
    integrations: [
        new CaptureConsole({
            levels: ["error"],
        }),
    ],
});

It is a workaround that still does logging to Sentry in local dev. Not yet tried in production

dotsafe-tech commented 1 year ago

Event not fired to Sentry in managed and bare workflow

Steps to reproduce in managed

Sentry.init({ dsn: '***', enableInExpoDevelopment: true, debug: true, // If true, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to false in production });


* add config expo plugins (on managed project)

### Same on bare workflow after sentry-wizard install and eas build

functional sentry with sentry-expo@6.0.0 would be very helpful
jwktje commented 1 year ago

I did what @rauldeheer did and that seems to fix it for me too. But now the CLI nags me;

Some dependencies are incompatible with the installed expo version:
  sentry-expo@4.2.0 - expected version: ~6.0.0
hiddenist commented 1 year ago

Yeah, the nagging is an issue. Also, having expo doctor auto-fix issues will update it to the broken version.

I was sad to see that upgrading from 5.x to 6.x when I went from expo sdk 46 to 47 didn't address the issue.

EmanuilM commented 1 year ago

I downgraded sentry-expo to version 4.2.0 and everything works now.

It works fine on development enviroment but on productions doesn't work. When you open the app in production enviroment the app crashes and throw following error in sentry dashboard "NativeArgumentsParseException: RNSentry.captureEnvelope got 3 arguments, expected 4"

gregdburns commented 1 year ago

I have Sentry working with Expo 47 and EAS build. I have more info in this ticket if people want to see my config setup: https://github.com/expo/sentry-expo/issues/285. Hopefully that helps some of you all.

dotsafe-tech commented 1 year ago

@gregdburns @NikkiDelRosso I can confirm that Expo 47 and sentry-expo@6.0.0 working great on Sentry Cloud. This is where it finds the subtlety, it does not work on our self-hosted sentry due to the old version we use.

krystofwoldrich commented 1 year ago

@ExGiX That error happens because of a miss match of the JS SDK and the native functions. You have to rebuild the whole app including the native bits.

More here: https://github.com/expo/sentry-expo/issues/295

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

sergeushenecz commented 1 year ago

I have same issue on 48 sdk also. I add sentry how in documentation but sentry not display on the sentry ui.

raulsanchez1024 commented 1 year ago

Also seeing a build issue on expo 47 & 48. Had to uninstall sentry-expo to get a green build image

raulsanchez1024 commented 1 year ago

Ok, after days of being stuck on this issue, I finally found my problem. I never created a SENTRY_AUTH_TOKEN env variable 🤦‍♂️

krystofwoldrich commented 1 year ago

@raulsanchez1024 Hi, Im sorry about that. This sound like something that should be in the docs, what page were you looking at?

unipine commented 1 year ago

@rauldeheer, hi, that works for me too, but subversions are recognized as issues by expo-doctor. and higher versions of sentry support many advantages. anyone have a solution to get the higher version working?

joshnwosu commented 1 year ago

Any updates on this?

kbrandwijk commented 1 year ago

There's a variety of different issues reported in this thread, along with a number of solutions/discoveries that addressed them. I'm going to close this issue as there doesn't seem to be anything actionable left for us. Feel free to open a new issue if you're experiencing any issues.

bitzr01 commented 1 year ago

the original problem still exists and the only working solution is downgrading to version 4.2.0 that cant be the final soluton?