File transfer java.security.cert.CertPathValidatorException

#1

hello,

I am trying to build file transfer into the app, but every time i try to upload a file i get greeted with

FileTransferError
   body: null
   code: 3
   exception: "java.security.cert.CertPathValidatorException: Trust anchor for certification path not found."
   http_status: null
   source: "file:///storage/emulated/0/Download/order69639758.pdf"
   target: "https://URL/link/to/api/attachments"

now for this testing i use the development branch and i link the URL to my pc. it works fine for all post and gets and it also works fine when updating for live.

The attachments on the other hand don’t work. There is no certificate on the android device and site.
would there by any chance be a solution for rooted android devices during development or do i have to create a certificate for this matter?
the android phone where i have been testing on is android 7.1.2 and i read that more people have trouble with android 7.

function

const fileTransferObject: FileTransferObject = this.fileTransfer.create();
        
        let trustAllHosts = true;

        let options: FileUploadOptions = {
            fileKey: 'file',
            fileName: '*.*',
            mimeType: 'multipart/form-data',
            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
            params: {'user_id': this.data.User, 'token': this.data.Token, 'project_id': projects['project_id']}
        }
        
        fileTransferObject.upload(this.attach, 'https://URL/link/to/api/attachments', options, trustAllHosts)
        .then((data) => {
            console.log(data);
        }, (err) => {
            console.log(err);
        });

the URL is my ip4v for xampp

#2

Did you manage to solve this ?

#3

yeah. for me the fix was using an actually site instead of a xampp/wampp based host. since xampp/wampp don’t have certificates and the actual live site does.

#4

Yeah I finally managed to do it even on my local MAMP server ! But it’s been tough haha