question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Unknown Error after compiling the application

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior:

Good day. I have an error in HttpClient after compiling the application. When entering the apk it works perfect, but I give login or register does not progress. I was able to extract the error back and the following comes out: {“header”: {“normalizedNames”: {}, “lazyUpdate”: null, “headers”: {}}}, “status”: 0, “statusText”: “unknown error”, “url”: “MY_URL_API” , “ok”: false, “name”: HttpErrorResponse “,” message “:” Http failure response for MY_URL_API: 0 Unknown Error “,” error “: {” isTrusted ": true}}

It should be noted that running ionic serve everything works perfect.

Expected behavior: That works the same as it works in the browser.

Steps to reproduce: The problem is based on the fact that the post, get requests do them perfectly in the browser, but when compiling the app and executing it, it does not perform the actions.

Related code:

login(email: String, password: String) {
    const headers = new HttpHeaders({
      'Accept': 'application/json'
    });

    return this.http.post(this.env.API_URL + 'auth/login',
      {email: email, password: password}, { headers: headers }
    ).pipe(
      tap(token => {
        this.nativeStorage.setItem('token', token)
        .then(
          () => {
            console.log('Token Stored');
          },
          error => console.error('Error storing item', error)
        );
        this.token = token;
        this.isLoggedIn = true;
        return token;
      }),
    );
  }

The problem is that it always returns the following error, but only when running the app on the cell phone or emulator.

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

With Error

Without Error

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
josuelmmcommented, May 24, 2019

I just found the solution here: https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie

I hope this post is not forgotten. Inside the AndroidManifest.xml add the android tag: usesCleartextTraffic = “true”

<application     android: usesCleartextTraffic = “true”     .     .     .>

0reactions
ionitron-bot[bot]commented, Jun 23, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix "Error Compiling Movie. Unknown Error"
Errors that have a known explanation can be easily resolved. The dialogue box that shows the error usually specifies the problem that the...
Read more >
JDev 9.0.2 UI Editor : Unknown Error In Source — oracle-tech
Hi, The 'Unknown Error in Source' message usually results because the java code could not properly be parsed. Try compiling your project first ......
Read more >
Solved: "Error compiling movie. Unknown Error." OR program...
It's a huge bug in the software ecosystem that Adobe is trying to create with CC and really needs to be addressed. "Unknown...
Read more >
Can't build: "An unknown error has… | Apple Developer Forums
- I need to test and debug in OS 10.10. The project opens in Xcode 6.4. However, the Build For commands are all...
Read more >
How to troubleshoot an "Unknown error occurred"?
I wonder how experienced users troubleshoot the unknown errors. ... a particular bug but about troubleshooting teqniques that experienced App developers use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found