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

getCurrentHub: Incorrect deprecation notice? #663

Closed
Senexis opened this issue Jun 4, 2024 · 1 comment · Fixed by #664
Closed

getCurrentHub: Incorrect deprecation notice? #663

Senexis opened this issue Jun 4, 2024 · 1 comment · Fixed by #664
Assignees

Comments

@Senexis
Copy link

Senexis commented Jun 4, 2024

Hey all!

I'm currently trying to close the Sentry connection on runtime whenever we detect an app update is available and the user has been prompted. As I'm lead to believe the current way to do so is as below, however, this prompts a deprecation notice to use Sentry.getClient() instead. This method does not exist, thus it seems this deprecation notice is incorrect.

Sentry.getCurrentHub().getClient().close(0); // deprecated, but works
Sentry.getClient().close(0); // Sentry.getClient is not a function

In contrast it does seem to work correctly when trying to close a Vue-specific instance of Sentry. In other words, this following prompts (correctly) to use the alternative:

SentryVue.getCurrentHub().getClient().close(0); // deprecated, but works
SentryVue.getClient().close(0); // works just fine

While having to go through this many hoops to simply disable Sentry seems like a drag, that is a separate issue, though I would like to know whether this is correct, or whether only Sentry or SentryVue needs to be closed.

I'm currently using the following Sentry-relevant packages:

"@sentry/capacitor": "0.18.0",
"@sentry/vite-plugin": "2.18.0",
"@sentry/vue": "7.114.0",
@lucas-zimerman
Copy link
Collaborator

Thank you for opening this issue, currently getClient isn't exposed but we'll expose it on the next release.
Also in regard to your issue we will also expose a close function on Capacitor that allows it to close both native and JavaScript SDKs.

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

Successfully merging a pull request may close this issue.

2 participants