sentry-capacitor icon indicating copy to clipboard operation
sentry-capacitor copied to clipboard

Uncaught SentryError: Native Client is not available, can't start on native.

Open dodomui opened this issue 3 years ago • 8 comments

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version?

@sentry/angular: ^7.6.0
@sentry/capacitor: ^0.6.1

Ionic:

   Ionic CLI                     : 6.20.1
   Ionic Framework               : @ionic/angular 6.1.13
   @angular-devkit/build-angular : 14.0.5
   @angular-devkit/schematics    : 14.0.5
   @angular/cli                  : 14.0.5
   @ionic/angular-toolkit        : 6.1.0

Capacitor:

   Capacitor CLI      : 3.6.0
   @capacitor/android : 3.6.0
   @capacitor/core    : 3.6.0
   @capacitor/ios     : 3.6.0

Steps to Reproduce

Had been using sentry capacitor plugin for several months. This issue happens recently and unable to initial sentry service and App at all.

error.js:8 Uncaught SentryError: Native Client is not available, can't start on native.
    at new SentryError (error.js:8:28)
    at 41406 (wrapper.js:336:25)
    at __webpack_require__ (bootstrap:19:1)
    at 88931 (index.js:2:1)
    at __webpack_require__ (bootstrap:19:1)
    at 71571 (eventorigin.js:2:1)
    at __webpack_require__ (bootstrap:19:1)
    at 82103 (scope.js:7:1)
    at __webpack_require__ (bootstrap:19:1)
    at 85208 (xhr.js:49:2)

dodomui avatar Jul 09 '22 16:07 dodomui

Hi, you'll need to upgrade the SDK in order to use Angular 14, additionally, if you are targeting the Web, another release will be done in order to properly support Angular 14 on the web.

lucas-zimerman avatar Jul 20 '22 14:07 lucas-zimerman

I have the same problem with version 0.8.0. The Ionic Capacitor app can't init (black screen), these lines appear in xCode Logs:

------ STARTUP JS ERROR ------

⚡️  n: Native Client is not available, can't start on native.
⚡️  URL: capacitor://localhost/main.fe0c96946f76f8c1.js
⚡️  [error] - {"name":"n"}
⚡️  main.fe0c96946f76f8c1.js:1:273974

arturomf avatar Jul 26 '22 14:07 arturomf

I have the same problem with version 0.8.0. The Ionic Capacitor app can't init (black screen), these lines appear in xCode Logs:

------ STARTUP JS ERROR ------

⚡️  n: Native Client is not available, can't start on native.
⚡️  URL: capacitor://localhost/main.fe0c96946f76f8c1.js
⚡️  [error] - {"name":"n"}
⚡️  main.fe0c96946f76f8c1.js:1:273974

Hi, Are you using Angular? and which version are you using from sentry/angular, sentry/vue,... ?

lucas-zimerman avatar Jul 27 '22 00:07 lucas-zimerman

Hi Lucas, I'm using:

@sentry/angular: 7.6.0 @sentry/capacitor: 0.8.0

and Angular 14

arturomf avatar Jul 27 '22 07:07 arturomf

Hi, I also have the same Issue on Web, on Angular 13, even after upgrading @sentry/capacitor to 0.8.0. Also tried downgrading to 0.7.0 and 0.6.1. Even setting the enableNative flag to false doesn't seem to change anything. Perhaps there's some additional configuration, other than initialization, needed for it to work both on web and native clients that I'm missing?

@arturomf My temporary workaround is to conditionally initialize the Capacitor Sentry and directly Angular Sentry based on isNativePlatform method from Capacitor.

WetCouch avatar Aug 01 '22 17:08 WetCouch

Hi @WetCouch, could you share some code examples of that initialization? I've tried your workaround with no success.

I really appreciate any help you can provide.

arturomf avatar Aug 08 '22 14:08 arturomf

Hi @arturomf, I did it this way:

import { Capacitor } from '@capacitor/core';
import * as SentryAngular from '@sentry/angular';
import * as Sentry from '@sentry/capacitor';

const Options = {
    dsn: '<dsn>',
    release: '<release>',
    dist: '<dist>'
};

export const sentryInitializer = () => {
    if (Capacitor.isNativePlatform()) {
        Sentry.init(Options, SentryAngular.init);
    } else {
        SentryAngular.init(Options);
    }
};

and then simply executed sentryInitializer() in main.ts

Seems to work and doesn't throw any errors on web ✌️

WetCouch avatar Aug 16 '22 12:08 WetCouch

Thanks, @WetCouch, I have tried your solution, but running the capacitor app on an actual device still throws the error.

I think there is a bug in capacitor-sentry.

arturomf avatar Aug 22 '22 09:08 arturomf

Hi @arturomf sorry for the late response.

Ok just to be sure, this issue is only happening on an actual device but not on an emulator/simulator?

Also, if the problem still persists, would you mind sharing a minimal repro project on Github?

lucas-zimerman avatar Sep 20 '22 12:09 lucas-zimerman

Hi @lucas-zimerman, I only use real devices to test.

The error is thrown in a new blank Ionic 6 - Capacitor 3/4 - Angular 14 app without any other plugin installed.

arturomf avatar Sep 20 '22 13:09 arturomf

Native Client is not available, can't start on native

I have tried on Android and iOS with the latest Sentry Capacitor, and I wasn't able to reproduce it.

Could you check if the issue is also happening in simulators/emulators? also, which package manager are you using? (npm, yarn,... )

lucas-zimerman avatar Sep 21 '22 14:09 lucas-zimerman

Hi Lucas, after updating to v0.10 the error has disappeared.

thanks!

arturomf avatar Sep 22 '22 07:09 arturomf

Closing as solved, if the problem persists, feel free to reopen this issue :)

lucas-zimerman avatar Sep 23 '22 07:09 lucas-zimerman