{"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url): 0 Unknown Error","error":{"isTrusted":true}}

Hello, I have on my logs this error which I tried to reproduce with different devices but I have never been able to.

{“headers”:{“normalizedNames”:{},“lazyUpdate”:null,“headers”:{}},“status”:0,“statusText”:“Unknown Error”,“url”:null,“ok”:false,“name”:“HttpErrorResponse”,“message”:“Http failure response for (unknown url): 0 Unknown Error”,“error”:{“isTrusted”:true}}

This error comes from this function which calls to google api:

public verifySex(file,accessToken,userId,version) {
return new Promise((resolve, reject) => {
this.http
.post(
https://automl.googleapis.com/v1beta1/projects/XXXXX/locations/us-central1/models/XXXXXXXXXX:predict”,
file,
{
headers: {“Authorization”:"Bearer "+accessToken}
}
)
.timeout(600000)
.map(res => res)
.toPromise()
.then(
//call then instead of subscribe to form the promise chain.
data => {
resolve(data);
},
err => {
reject(err);
this.utilsService.registerEvent(err,userId,version)
}
);
});
}

I don’t know how to solve it and how can reproduce it. It is generating 10 or 15 errors a day. Can anybody help me? Thanks!

1 Like

Some help here please?

did you find any solution. Im stuck with same issue.

Nothing at the moment, did you find a solution?

Correct me if I’m wrong, but I think it’s because you used the wrong format for http headers, it should be

headers: new HttpHeaders({
...
})

this tute shows an example of the new format that worked for me when i facing the same issue
https://www.positronx.io/create-ionic-angular-http-service/