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

Is there a way to access the options if not initing the SDK automatically for Hybrid SDKs? #1665

Closed
marandaneto opened this issue Feb 22, 2022 · 5 comments · Fixed by #1991
Closed

Comments

@marandaneto
Copy link
Contributor

Problem Statement

See https://github.com/getsentry/sentry-react-native/blob/b8169cf6ceee8a2df5b138091e8d8766943a2574/ios/RNSentry.m#L75
and https://github.com/getsentry/sentry-react-native/blob/b8169cf6ceee8a2df5b138091e8d8766943a2574/ios/RNSentry.m#L130-L137

So options are only cached if the SDK is inited. automatically by the Hybrid SDK.
The thing is, the Hybrid SDK allows to not init. the SDK automatically, See https://github.com/getsentry/sentry-react-native/blob/b8169cf6ceee8a2df5b138091e8d8766943a2574/src/js/options.ts#L27-L38

So every feature that depends on the options to be cached, won't work.
The same for Flutter, found out by PoCing getsentry/sentry-dart#265

Solution Brainstorm

Java has the concept of HubAdapter which can be achieved by HubAdapter.getInstance().getOptions(), this is not considered a Public API.

@philipphofmann
Copy link
Member

philipphofmann commented Mar 1, 2022

Sorry, I don't fully understand what we want to achieve here, @marandaneto. What exactly do you mean by caching the options? What does HubAdapter.getInstance().getOptions() return if you don't initialize the SDK. Some default options without a DSN?

@marandaneto
Copy link
Contributor Author

@philipphofmann HubAdapter.getInstance().getOptions() returns an empty options since the Hub is also NoOpHub.
If the SDK is inited. then it returns the real options from the Hub.

We'd like to support the manual Native initialization and for that, we'd need to know the cache dir path that comes from the native SDK, but if somebody has to init. the Native SDK manually, we don't have access to the options nor to the cache dir path.

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@brustolin brustolin changed the title Is there a way to access the options if not initing the SDK automatically for Hybrid SDKs? x Apr 28, 2022
@brustolin brustolin changed the title x Is there a way to access the options if not initing the SDK automatically for Hybrid SDKs? Apr 28, 2022
@brustolin
Copy link
Contributor

Would a new function in PrivateSentrySDKOnly class that returns the current option or an empty one solve this?

@marandaneto
Copy link
Contributor Author

Would a new function in PrivateSentrySDKOnly class that returns the current option or an empty one solve this?

Yes, that's the goal of this issue.

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.

3 participants