sentry-capacitor
sentry-capacitor copied to clipboard
Uncaught SentryError: Native Client is not available, can't start on native.
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)
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.
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
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,... ?
Hi Lucas, I'm using:
@sentry/angular: 7.6.0 @sentry/capacitor: 0.8.0
and Angular 14
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.
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.
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 ✌️
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.
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?
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.
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,... )
Hi Lucas, after updating to v0.10 the error has disappeared.
thanks!
Closing as solved, if the problem persists, feel free to reopen this issue :)