sentry-react-native: Could not connect to Sentry native SDK.

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native
  • react-native-sentry

react-native version: 0.60.5 @sentry/react-native version: 1.0.6

Init Code:

Sentry.init({
  dsn: 'https://e94b9990199c4a44b0ff2ae02f2cb754@sentry.io/1726750',
  debug: true,
});

I have following issue:

Installation is successful using sentry-wizard, however, prompted with “… cannot connect to Sentry Native SDK”.

Steps to reproduce:

  1. Installed sentry package using yarn add @sentry/react-native. (I also have @sentry/wizard globally installed for other projects).
  2. Ran the sentry wizard sentry-wizard --debug; stdout of --debug.
  3. cd ios && pod install; stdout of pod installation below:
➜  ios git:(feat/sentry) ✗ pod install
Detected React Native module pods for RNDeviceInfo, RNGestureHandler, RNSVG, RNScreens, and react-native-aes
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `FBLazyVector` from `../node_modules/react-native/Libraries/FBLazyVector`
[!] No podspec found for `FBLazyVector` in `../node_modules/react-native/Libraries/FBLazyVector`

[!] use_native_modules! skipped the react-native dependency 'react-native-rsa-native'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

[!] use_native_modules! skipped the react-native dependency 'realm'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library
  1. Rebuilt the app using xcode.
  2. Opened the app after initialising sentry and received: Simulator Screen Shot - iPad (6th generation) - 2019-09-26 at 11 28 41.

Notes

  • Should I expect to see RNSentry in cocoa pod installation stdout e.g. Detected React Native module pods for RNDeviceInfo, RNGestureHandler, RNSVG, RNScreens, and react-native-aes
  • sentry.properties file is populated with the right data; cli.executable is correct.
  • Changes to project.pbxgroup include:
		B01732A670324C0683690BD9 /* Frameworks */ = {
			isa = PBXGroup;
			children = (
			);
			name = Frameworks;
			path = Application;
			sourceTree = "<group>";
		};
		5BFB0AD478EB4D31A0F78D2B /* Frameworks */ = {
			isa = PBXGroup;
			children = (
			);
			name = Frameworks;
			path = Application;
			sourceTree = "<group>";
		};
/* Begin PBXShellScriptBuildPhase section */
shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh";
/* Upload Debug Symbols to Sentry */
isa = PBXShellScriptBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
			name = "Upload Debug Symbols to Sentry";
			inputPaths = (
			);
			outputPaths = (
			);
			shellPath = /bin/sh;
			shellScript = "export SENTRY_PROPERTIES=sentry.properties\n../node_modules/@sentry/cli/bin/sentry-cli upload-dsym";

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 19 (3 by maintainers)

Most upvoted comments

I was getting the same issue. I was able to resolve it by deleting my node_modules and ios/Pods directories, then running yarn install; cd ios; pod install – was also able to confirm that my thrown error was received by Sentry after doing this.

proper linking sorted out for me by adding pod ‘RNSentry’, :path => ‘…/node_modules/@sentry/react-native’

then pod install

I am closing this issue for now since this is almost always related to that the @sentry/react-native is not linked properly. We created this popup so you are aware of it, it’s a debug thing. If you see this autolinking of react-native might not work, or you upgraded react-native from an old version. Make sure to relink

rm -rf node_modules
react-native unlink @sentry/react-native
npm install
react-native link @sentry/react-native

i have the same issue. but in my case, that message alter both in android and ios @sentry/react-native version: 1.0.9

I think why many people are confused is because it is not clear from this documentation that you havce to link at all https://docs.sentry.io/platforms/react-native/#linking

The documentation only tells me to link if i am running react-native < 0.60

Adjusting the documentation will bring clarity

HELP ME PLEASE

image

I am experiencing the same issue on RN 0.60.5, @sentry/react-native version 1.2.0.

We suspect it to be due to autolinking not working properly, which we have experienced with other modules after upgrading from RN <0.60, when we had to do the switch from manual to automatic linking.

Following this anyway, in case its not related to our specific setup.

Been having this issue all day. Can’t seem to find a fix. Started up a fresh project and can confirm that it works as expected, however when I duplicate the install steps into my existing project I get the pop-up every time. enableNative: false seems to have no effect.

@HazAT is there any steps that I might try, other than the above to see what I’ve got wrong?

my android is right,but ios has this problem. so link it 1/ get RNSentry.xcodeproj from @sentry/react-native/ios, add it to ios project Libraries. 2/ Targets — General—Frameworks, Libraries… add libRNSentry.a 3/ Targets— Build Phases — Link Binary… add libRNSentry.a WORKS

I also get the error that it cannot connect to the SDK and I’m not sure how i’m supposed to follow this setup while using npm

npx sentry-wizard -i reactNative -p ios android throws the following error

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/sentry-wizard - Not found    
npm ERR! 404 
npm ERR! 404  'sentry-wizard@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)     
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

It seems that the issue is the npm repo moved and the docs haven’t been updated.

https://www.npmjs.com/package/@sentry/wizard

Doing:

npx @sentry/wizard -i reactNative -p ios android

looks to work and so far, so good.

>= 0.60 supports autolinking and I just created a clean project and it works without calling link. So I am not sure what to write. Sadly RN is very bad when it comes to upgrading it from an older version it also sometimes heavily depends on the setup of your project.

Had exactly the same problem, after i ran these commands it worked on android (developing on Windows) i am using
“react-native”: “0.61.4”,

rm -rf node_modules react-native unlink @sentry/react-native npm install react-native link @sentry/react-native gradlew.bat clean react-native start “–clear-cache”

npm run android

so it seems that if you link with react-native link it works i used the wizard before and it was finishing succesfully but i still got the same popup as op

hope this helps

I’m having a similar issue. I tried deleting node_modules and ios/Pods, and neither worked. Following this thread to see if there’s a solution.

RN Version 0.59.9 @sentry/react-native version: 1.2.0

I think this is more than likely an issue with my apps autolinking. The pod installation doesn’t seem right.