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

Does not work with Expo 46: Native SKD Info retrieval failed #285

Closed
gregdburns opened this issue Aug 31, 2022 · 36 comments
Closed

Does not work with Expo 46: Native SKD Info retrieval failed #285

gregdburns opened this issue Aug 31, 2022 · 36 comments

Comments

@gregdburns
Copy link

gregdburns commented Aug 31, 2022

Summary

When building an app with Expo SDK 46 and the recent versions of the dependent libraries, Sentry does not log events, and shows the warnings:

iOS:

WARN Sentry Logger [warn]: [SdkInfo] Native SDK Info retrieval failed...something could be wrong with your Sentry installation:
WARN Sentry Logger [warn]: [SentryError: Native is disabled]
LOG Sentry Logger [log]: Failed to get device context from native: SentryError: Native is disabled
WARN Sentry Logger [warn]: Event was skipped as native SDK is not enabled.

Android:

Sentry Logger [warn]: Event was skipped as native SDK is not enabled.

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)

46.0.9

Environment

expo-env-info 1.0.5 environment info:
System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: ~46.0.9 => 46.0.9
react: 18.0.0 => 18.0.0
react-native: 0.69.5 => 0.69.5
Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

A Snack that can repro here: https://snack.expo.dev/@blackline/surprised-kiwi.

Please make sure to update the Sentry config with a working DSN.

Please run the Snack in iOS or Android to reproduce the issue.

When pressing the "Press" button, the Sentry warnings can be observed in the console.

@gregdburns
Copy link
Author

gregdburns commented Aug 31, 2022

I am going to document my findings here, as this was a confusing journey, and I'd like confirmation that my assumptions (and config) are correct.

  1. I changed the enableNative config prop to true before doing eas build. Now I am seeing errors in Sentry.
  2. enabledNative: true creates issues when running in Dev mode with Expo Go, so for our dev config we're setting this to false, as well as setting debug to false so that we don't see the errors.
  3. Additionally, Expo implemented a fix to resolve @sentry/react-native version conflicts. Upgrade to the latest Expo 46 patch and Sentry lib versions.

With that said, I can't get Expo Go to write any errors to Sentry because of these issues, which is fine, but makes troubleshooting Sentry configs pretty difficult.

@danielgangverk
Copy link

danielgangverk commented Sep 5, 2022

I have the same problem with testing Sentry errors in Expo go on Expo SDK 46. When I set enabledNative: true in Sentry.init I get these errors:

ERROR SentryError: Native Client is not available, can't start on native.
ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

This happens on iOS simulator & iOS phone

@mirchat
Copy link

mirchat commented Sep 6, 2022

Using Expo SDK 46 with an Android phone.
I did add enabledNative: true, but I still have: Sentry Logger [warn]:, Event was skipped as native SDK is not enabled.

Any ideas ?

@gregdburns
Copy link
Author

@mirchat the only workaround I found was to turn Sentry off for development, which suppresses the warning. This means that I can't really test Sentry using local dev / Expo Go, so I create standalone apps to test the connection. I can see that I'm writing to Sentry now, but I'm still troubleshooting an issue where the source maps aren't being uploaded.

Here's my config for development:

export const developmentSentryConfig = {
...sentryConfig,
debug: false, // Sentry will try to print out useful debugging information if something goes wrong with sending an event.
enableInExpoDevelopment: false, // Set to true to enable capturing data for local/dev errors.
enableNative: false,
environment: 'develoment'
}

@jacoporicare
Copy link

jacoporicare commented Sep 7, 2022

Could this be related?
https://docs.sentry.io/platforms/react-native/troubleshooting/#react-native-069-and-higher

Expo 46 uses RN 0.69 and it seems that Sentry doesn't work with that version now - there's a fix in sentry-react-native@5 which is currently in alpha.

See this issue:
getsentry/sentry-react-native#2267

Anyway, my Sentry logging stopped working - Sentry.Native.captureMessage doesn't log anything from the production build.

@gregdburns
Copy link
Author

Good question. @kbrandwijk did Expo include the workaround stated here: https://docs.sentry.io/platforms/react-native/troubleshooting/#react-native-069-and-higher? Or could this be the root cause of the issue where source maps aren't uploaded?

FWIW, I am able to send data to Sentry with the current versions of Expo 46 and Sentry, it just doesn't upload the source maps.

@jacoporicare if you're not seeing data, take a look at my config to see if it matches what you have, and make sure that you are using the latest Expo patch and that your @sentry/react-native version is pinned to 4.2.2 (see #281).

@danielgangverk
Copy link

I tested running Expo with the expo-dev-client with a eas test build as described here https://docs.expo.dev/development/getting-started/ and sending events works. It's still a bit annoying that when setting enableNative: true and running the app in Expo go it just crashes.

@jacoporicare
Copy link

jacoporicare commented Sep 7, 2022 via email

@loorko
Copy link

loorko commented Sep 8, 2022

I have a same problem.

`Sentry Logger [warn]:, [SdkInfo] Native SDK Info retrieval failed...something could be wrong with your Sentry installation:
at node_modules/@sentry/utils/cjs/logger.js:66:12 in consoleSandbox$argument_0
at node_modules/@sentry/utils/cjs/logger.js:41:19 in consoleSandbox
at node_modules/@sentry/utils/cjs/logger.js:65:24 in name
at node_modules/@sentry/react-native/dist/js/integrations/sdkinfo.js:28:20 in __awaiter$argument_3
at node_modules/tslib/tslib.js:113:50 in rejected

Sentry Logger [warn]:, [SentryError: Native is disabled]
at node_modules/@sentry/utils/cjs/logger.js:66:12 in consoleSandbox$argument_0
at node_modules/@sentry/utils/cjs/logger.js:41:19 in consoleSandbox
at node_modules/@sentry/utils/cjs/logger.js:65:24 in name
at node_modules/@sentry/react-native/dist/js/integrations/sdkinfo.js:29:20 in __awaiter$argument_3
at node_modules/tslib/tslib.js:113:50 in rejected`

@sentry/react-native": "4.2.2",
"expo": "^46.0.10",
"expo-application": "~4.2.2",
"expo-constants": "~13.2.4",
"expo-device": "~4.3.0",
"expo-updates": "~0.14.5",
"sentry-expo": "^5.0.2",
"react": "18.0.0",
"react-native": "^0.69.5"

@nicomfe
Copy link

nicomfe commented Sep 23, 2022

Same problem for me, no warnings in console but nothing in Sentry when capturing exceptions

Dependencies

"expo": "46.0.10",
"sentry-expo": "5.0.2",
"@sentry/react-native": "4.2.2",
"expo-device": "4.3.0",
"expo-updates": "0.14.5",
"expo-constants": "13.2.4",
"expo-application": "4.2.2",

Sentry init

Sentry.init({
      dsn: MY_SENTRY_DSN,
      enableInExpoDevelopment: true,
      debug: true,
    })

And Im trying to send an error to Sentry like this:

try {
    throw new Error('Testing error')
} catch (error) {
    Sentry.Native.captureEvent(error)
    Sentry.Native.captureException(error)
}

I get no warnings in my console, and nothing on Sentry. This was working on expo sdk 44. Any idea would be helpful.

@aeife
Copy link

aeife commented Oct 28, 2022

We also are experiencing this issue. No events are received by sentry in production using a standalone app since sdk 46 and sentry expo 5. When I was trying to debug it I can in the mentioned issue with the native sdk.
What is working for me is downgrading sentry-expo to 4.2.0 even though that is not the official supported version of expo sdk 46. But a lot of other devs are reporting that this is working for them here #243. So something seems to be broken in the newest version?

I already tried newest sentry-expo version (5.0.3) and newest expo sdk 46 (46.0.16) but sentry only receives error logs when I downgrade.

@nicomfe
Copy link

nicomfe commented Oct 28, 2022

@aeife I was just testing capturing events with expo go, and apparently that doesnt work with Expo 46 and sentry-expo
When I created a dev-client build, I started seeing events again in Sentry.

@aeife
Copy link

aeife commented Oct 28, 2022

Yes I think there is no way around that for expo go. Additionally it was not working for me for standalone builds except with sentry-expo 4.2.0. But I just found the issue: I was missing @sentry/react-native as dependency in my package.json file. Added that and created a new standalone build (using now sentry-expo 5 again) and it now works again.

So any dev that worked around the issue using the downgrade should probably check that. I'm reading any SDK release post very carefully but I somehow missed the need for this direct dependency and it seems it only became crucial with the latest SDK update.

@sergeushenecz
Copy link

I have same issue. Can confirm downgrade to sentry-expo 4.2.0 works in eas build

@curtisd14
Copy link

curtisd14 commented Nov 10, 2022

Can confirm this is still an issue with Expo 47

Currently running:
sentry-expo: 5.0.3
@sentry/react-native: 4.2.2

@Ross-Landry
Copy link

Ross-Landry commented Nov 15, 2022

I have same issue. Can confirm downgrade to sentry-expo 4.2.0 works in eas build

Same for me, I wasn't seeing any error reports in the sentry dashboard until I downgraded sentry-expo

For what it's worth, I definitely had @sentry/react-native included in my package.json.

Didn't work:
@sentry/react-native: 4.2.2
sentry-expo: 5.0.3

Working:
sentry-expo: 4.2.0

@cgav
Copy link

cgav commented Nov 17, 2022

I found a solution that works for me on iOS after hours of trying out different versions and setups. I'm still testing Android at the time of writing this. Maybe it'll help you too:

Versions of packages:

@sentry/react-native: 4.2.2
expo: 47.0.6
sentry-expo: 5.0.3

It is VERY important to import Sentry from @sentry/react-native and NOT sentry-expo as this causes the event not to be registered on the sentry.io dashboard. Here is my JS/TS code:

import * as Sentry from '@sentry/react-native';

Sentry.init({
  dsn: '...',
  debug: true,
});

setTimeout(() => {
  throw new Error('Test error');
}, 3000);

For what it's worth, when jumping back and forth between different versions of npm packages I forgot to restart expo start --dev-client, which I think might have caused the current setup not working.

@hiddenist
Copy link

This still appears to be an issue with Expo SDK 47.0.8 and sentry-expo 6.0.0

@zlanich
Copy link

zlanich commented Dec 9, 2022

This has been an issue for me on SDK 46-47. My Sentry stack traces are useless on JSEngine or Hermes. I looked all over the internet for info on this and spoke to people on Discord, and I'm at a loss. Example stack trace:
no-sentry-stacktrace

I am using babel-plugin-root-import, so that could be an issue:
babel-config

Notable app.config.js fields:
app-config

@kirtikapadiya
Copy link

This works for me
Expo: 46
sentry-expo: 4.2.0
@sentry/react-native: 4.2.2.

@hiddenist
Copy link

hiddenist commented Dec 12, 2022

Yes, it works with either expo sdk 46 or 47 and sentry-expo 4.2.0 (no explicitly installed version of @sentry/react-native was necessary, as sentry-expo has it as a dependency rather than peerDependency), but only if I force npm install to use legacy peer deps, and ignore the expo doctor warnings. It's not ideal.

@amourlanne
Copy link

Same issue, not working with sdk 47 and sentry-expo 6.0.0 and @sentry/react-native 4.9.0

@EmanuilM
Copy link

EmanuilM commented Jan 4, 2023

I have same issue. Can confirm downgrade to sentry-expo 4.2.0 works in eas build

Same for me, I wasn't seeing any error reports in the sentry dashboard until I downgraded sentry-expo

For what it's worth, I definitely had @sentry/react-native included in my package.json.

Didn't work: @sentry/react-native: 4.2.2 sentry-expo: 5.0.3

Working: sentry-expo: 4.2.0

Works fine on development enviroment but it doesn't work on production. When you open the app in production it crashes with this error
NativeArgumentsParseException: RNSentry.captureEnvelope got 3 arguments, expected 4

@gregdburns
Copy link
Author

For what it's worth, I have Sentry working in non-development (meaning apps built using eas build) with the latest libraries

  • Expo v47
  • "@sentry/react-native": "4.9.0"
  • "sentry-expo": "~6.0.0"

While Sentry does not log in Dev mode, I've found it's easy enough to create a new build using EAS and test that way.

My App.json Sentry Config

"hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "my-sentry-org-name",
            "project": "my-sentry-project-name",
            "authToken": "SENTRY_AUTH_TOKEN"
          }
        }
      ]
    }

My Sentry Init Config

const sentryConfig = {
  dsn: 'sentrydsnhere',
  enableInExpoDevelopment: false, 
  environment: 'custom-environment-name'
  setCommits: true,
  enableNative: true, // Set to true to enable Sentry for EAS builds.
  logLevel: 3,
  debug: false
}

Additionally, I learned that hard way that it's better to omit the "release" property from the Sentry config and to let expo-sentry handle that, otherwise releases don't seem to get mapped to sourcemaps correctly.

I hope this helps!

@gregdburns
Copy link
Author

Closing this ticket as I was able to resolve my issues. Apologies to those who are using this to track other issues - please open another ticket if applicable.

@sergeushenecz
Copy link

sergeushenecz commented Jan 7, 2023

Can confirm this is still an issue with Expo 47

Currently running:
sentry-expo: 6.0.0

Downgrade to sentry-expo: 4.2.0 it is work

@EmanuilM
Copy link

EmanuilM commented Jan 8, 2023

Can confirm this is still an issue with Expo 47

Currently running: sentry-expo: 6.0.0

Downgrade to sentry-expo: 4.2.0 it is work

sentry-expo: 4.2.0 does not work on production enviroment

@sergeushenecz
Copy link

Maybe we have different configuration ?

@dotsafe-tech
Copy link

Can confirm this is still an issue with Expo 47

Currently running: sentry-expo: 6.0.0

Downgrade to sentry-expo: 4.2.0 it is work

@sergeu90 Are you on a Sentry cloud, or a specific version of sentry self hosted?

@sergeushenecz
Copy link

@dotsafe-tech Cloud.

@dotsafe-tech
Copy link

I can confirm that Expo 47, eas build 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.

@rahmanharoon
Copy link

still facing this issue
any workaround please

@ian
Copy link

ian commented Feb 20, 2023

Can confirm this is still an issue.

  • "expo": "~47.0.9",
  • "sentry-expo": "~6.0.0",
  • "@sentry/react-native": "4.9.0",

@harshad-kathiriya
Copy link

Can confirm this is still an issue.

  • "expo": "~47.0.9",
  • "sentry-expo": "~6.0.0",
  • "@sentry/react-native": "4.9.0",

It is working fine for me.

@anarkrypto
Copy link

Native crash reporting is not available in Expo Go, it is only available in standalone builds or development builds.

https://docs.expo.dev/guides/using-sentry/

@Ross-Landry
Copy link

Seems to be working for me now.

Current dependency versions:

"expo": "48.0.0",
"@sentry/react-native": "4.13.0",
"sentry-expo": "6.2.0"

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