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

Can't set other options in init #22

Open
jerbob92 opened this issue Jun 19, 2024 · 8 comments
Open

Can't set other options in init #22

jerbob92 opened this issue Jun 19, 2024 · 8 comments

Comments

@jerbob92
Copy link

jerbob92 commented Jun 19, 2024

When setting other options in the init, the code fails with:

  JS: CONSOLE ERROR: Error starting Sentry Error: Cannot convert boolean to Ljava/lang/Boolean; at index 0 Error: Cannot convert boolean to Ljava/lang/Boolean; at index 0
  JS:     at file: src/webpack:/MobileApp/node_modules/@nativescript-community/sentry/wrapper.android.js:346:55

For example in the following code:

Sentry.init({
	dsn: "dsnhere",
	enableAutoPerformanceTracking: true,
	enableTracing: true,
	tracesSampleRate: 1,
});

The error relates to the following line: https://github.com/nativescript-community/sentry/blob/master/src/sentry/wrapper.android.ts#L385

Perhaps a case for booleans need to be added as well?

Edit: looks like it's specifically enableTracing.

@farfromrefug
Copy link
Member

@jerbob92 just released a new version which should fix it

@jerbob92
Copy link
Author

@farfromrefug awesome, thanks! Will try it out!

@jerbob92
Copy link
Author

jerbob92 commented Jun 20, 2024

@farfromrefug that did not fully fix it it seems:

  JS: CONSOLE ERROR: Error starting Sentry Error: JNI Exception occurred (SIGABRT).
  JS: =======
  JS: Check the 'adb logcat' for additional information about the error.
  JS: =======
  JS:  Error: JNI Exception occurred (SIGABRT).
  JS: =======
  JS: Check the 'adb logcat' for additional information about the error.
  JS: =======
  JS:
  JS:     at file: src/webpack:/MobileApp/node_modules/@nativescript-community/sentry/wrapper.android.js:346:55
  JS:     at Array.forEach (<anonymous>)
  JS:     at io.sentry.Sentry.OptionsConfiguration.configure (file: src/webpack:/MobileApp/node_modules/@nativescript-community/sentry/wrapper.android.js:338:50)
  JS:     at Object.<anonymous> (file: src/webpack:/MobileApp/node_modules/@nativescript-community/sentry/wrapper.android.js:328:49)

logcat says:

.......
  at com.tns.gen.io.sentry.Sentry_OptionsConfiguration.configure(Sentry_OptionsConfiguration.java:19)
  at io.sentry.android.core.SentryAndroid.lambda$init$1(SentryAndroid.java:123)
  at io.sentry.android.core.SentryAndroid$$ExternalSyntheticLambda0.configure(unavailable:8)
  at io.sentry.Sentry.applyOptionsConfiguration(Sentry.java:194)
  at io.sentry.Sentry.init(Sentry.java:164)
  at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:87)
  - locked <0x0135e1b3> (a java.lang.Class<io.sentry.android.core.SentryAndroid>)
  at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:70)
.....


JNI DETECTED ERROR IN APPLICATION: unexpected jboolean value: 7
   in call to CallVoidMethodA
   from java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[])

@jerbob92
Copy link
Author

@farfromrefug it looks like change this broke more than it fixed. Before, most boolean options would work, but now most of them don't, and since there are some options in there by default, I can't init the client at all anymore.

It looks like the only options that did not work before your change are the ones marked as @Nullable Boolean (like enableTracing), and not as boolean (like attachStacktrace). https://github.com/getsentry/sentry-java/blob/main/sentry/src/main/java/io/sentry/SentryOptions.java

@farfromrefug
Copy link
Member

farfromrefug commented Jun 20, 2024

@jerbob92 ok i see! they use both :s and i have no way to "discover" it. Ok will add a special check
EDIT: now i actually see more that would fail with numbers :s

@farfromrefug
Copy link
Member

@jerbob92 published another version. Can you try?

@jerbob92
Copy link
Author

@farfromrefug yes, works! Only one that's failing now is tracePropagationTargets, it's an array of strings.

@farfromrefug
Copy link
Member

@jerbob92 Ok might add support for this in the future

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

2 participants