Trust anchor for certification path not found




I’m using in my app nativescript-background-http and @angular/common/http to connect with my API. The app works fine with my environment via https (Lets’ Encrypt) but when I started deploying the app in the production environment the following error occurred (RapidSSL):

JS: {
JS:   "headers": {
JS:     "normalizedNames": {},
JS:     "lazyUpdate": null,
JS:     "headers": {}
JS:   },
JS:   "status": 0,
JS:   "statusText": "Unknown Error",
JS:   "url": null,
JS:   "ok": false,
JS:   "name": "HttpErrorResponse",
JS:   "message": "Http failure response for (unknown url): 0 Unknown Error",
JS:   "error": {
JS:     "originalStack": "Error: Trust anchor for certification path not found.\n    at new ZoneAwareError (file:///data/data/org.nativescript.QualityCorner/files/app/vendor.js:67486:33)\n    at onRequestComplete (file:///data/data/org.nativescript.QualityCorner/files/app/vendor.js:98483:34)\n    at Object.onComplete (file:///data/data/org.nativescript.QualityCorner/files/app/vendor.js:98475:13)",
JS:     "zoneAwareStack": "Error: Trust anchor for certification path not found.\n    at onRequestComplete (file:///data/data/org.nativescript.QualityCorner/files/app/vendor.js:...

I’ve checked the certificate and it looks fine.
I know that the solution can be to use nativescript-https but I use nativescript-background-http to upload files in the background.

How can I fix it? Maybe the customer should fix its certificate?


If you are really dependent on background http plugin, then I would suggest you to take a fork of that plugin and customize the android file to use your own okhttpclient stack which will include your certificate. To know how to include a certificate in okhttpclient, you may refer the https plugin’s source.