nativescript-community / sentry

A cross-platform application monitoring tool, with a focus on error reporting.
Apache License 2.0
14 stars 6 forks source link

NS 8.2 - Android - `e.getMessage` is not a function on app launch #10

Open tylerablake opened 2 years ago

tylerablake commented 2 years ago

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital letter.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

I've tried with the following version of this plugin with the same results:

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Sentry.init({
  dsn: SentryConfig.dsn,  
});

Inside of the main.ts file, runs and uploads messages to Sentry on iOS.

On Android I get the following error on launch:

Unhandled Promise rejection: e.getMessage is not a function ; Zone: <root> ; Task: null ; Value: TypeError: e.getMessage is not a function TypeError: e.getMessage is not a function
JS:     at file: app/webpack:/mobile/node_modules/@nativescript-community/sentry/nssentry.android.js:461:84
JS:     at new ZoneAwarePromise (file: app/webpack:/mobile/node_modules/zone.js/fesm2015/zone.js:1427:0)
JS:     at Object.startWithDsnString (file: app/webpack:/mobile/node_modules/@nativescript-community/sentry/nssentry.android.js:317:15)
JS:     at new NativescriptBackend (file: app/webpack:/mobile/node_modules/@nativescript-community/sentry/backend.js:15:12)
JS:     at new BaseClient (file: app/webpack:/mobile/node_modules/@sentry/core/esm/baseclient.js:51:0)
JS:     at new NativescriptClient (file: app/webpack:/mobile/node_modules/@nativescript-community/sentry/client.js:16:0)
JS:     at initAndBind (file: app/webpack:/mobile/node_modules/@sentry/core/esm/sdk.js:17:0)

Is there any code involved?

tylerablake commented 2 years ago

It looks like it was angry with Application.android.context inside of nssentry.android so I made this change:

io.sentry.android.core.SentryAndroid.init(Application.android.context,

to

io.sentry.android.core.SentryAndroid.init(Utils.android.getApplicationContext(),

Then I got an error in convertToNativeStacktrace(stack) because the stack was undefined. Maybe that is because I'm missing some configuration for Android though?

farfromrefug commented 2 years ago

@tylerablake thanks i ll fix the start issues. About the convertToNativeStacktrace error can you add logs to see first the stacktrace of where it is called from and if possible the original event for which convertToNativeStacktrace is called. i think stack should never be null. Though i will handle it

farfromrefug commented 2 years ago

@tylerablake juste released 3.1.3

tylerablake commented 2 years ago

@farfromrefug Thanks for helping with this so quickly!

I'm trying to get some info for you but I'm only getting {} for stack from the convertToNativeStacktrace(stack) method. Unable to get to the event info but I'll keep trying.

tylerablake commented 2 years ago

I'm not sure if this what we're looking for but when I set debug: true in the Sentry.init() options, on Android I get this in the console when trying to send something up to Sentry.

JS: Sentry Logger [Warn]: Event dropped due to being a duplicate of previously captured event.
JS: Sentry Logger [Error]: SentryError: An event processor returned null, will not send event.

If I set debug:true then it doesn't throw an error but nothing is sent up to Sentry. On iOS I do not see this log and the events are sent to Sentry successfully.

farfromrefug commented 2 years ago

@tylerablake your events are not sent on android?

tylerablake commented 2 years ago

@farfromrefug Yeah that's what it looks like