-
Notifications
You must be signed in to change notification settings - Fork 83
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
Can't access Sentry methods like captureException or captureMessage #183
Comments
took me also a while to figure that out... use: I think this should be part of the documentation. |
Sentry works the same in Closing this since it is documented |
@cruzach it's not 100% clear to me how to make this work. Previously there were no Native + Browser, and it used to work without additional steps in managed + ExpoKit. Now if I want to test this in managed, it does not seem to work with either:
Now, I understand that for EAS build you need to add the plugin, and for bare workflow you need to follow additional instructions. Was wondering how to first make it work in dev + Expo Go, as I want to keep using it despite being ejected to Bare The doc does not explain very clearly when to use Native vs Browser? Am I supposed to switch implementation according to the context? (bare vs Expo Go) Note: the github readme still says |
Use Native in your native environments (iOS and Android apps), and Browser on web
I've tested this in managed workflow just yesterday for the new release, and confirmed it worked as expected. for example, to capture an error when running on Android or iOS, you would call |
import * as Sentry from 'sentry-expo';
// Use Sentry.Native.init() instead ?
Sentry.init({
dsn: 'YOUR DSN HERE',
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
}); Now what you say is that even in Expo Go I should use Actually this is what I get when running this code in Expo Go, SDK 41:
(it didn't work much better when using Browser, but only emit a warning) |
@slorber We export the
This isn't the recommended way to import, so I really recommend you follow the docs, it'll help avoid issues like this. This is what we document:
|
I see, didn't understand that the init was exposed directly and that it performs additional logic compared to Now using something that looks correct, but it's still not working in Expo Go 🤪
(new test project, the DSN is not sensitive) No console error this time, but no error reported either |
oh, I understand now 😓
We just reached the free plans limit and all the errors I try to send are now dropped. Unfortunately nothing tells me this apart the billing page... Sorry for losing your time... Creating a new org with an empty fresh quota definitively works as intended |
Summary
Sentry imported from 'sentry-expo' doesn't allow access to Sentry methods
Managed or bare workflow? If you have
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
No response
Environment
Expo CLI 4.0.17 environment info:
System:
OS: macOS 11.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.3 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.9 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages:
expo: ^39.0.0 => 39.0.5
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz => 0.63.2
react-native-web: ~0.13.7 => 0.13.18
Expo Workflow: managed
Reproducible demo or steps to reproduce from a blank project
import * as Sentry from 'sentry-expo'
import React, { useEffect } from 'react'
const Comp = () => {
useEffect(() => {
Sentry.captureMessage('123')
}, [])
}
The text was updated successfully, but these errors were encountered: