0

I have an issue with this type of error logging into the pm2 log file. There is no errors in browser, all API request statuses are 200. But, only on first use of application (when refresh page with browser button, or first time type URL) the error shows in log file. There is no error while using inner links for navigation.

I'm using Angular Universal on node Express, and fulfill all requirements. Have CORS set up properly on server (nginx).

There is an error:

ERROR HttpErrorResponse {

headers:

HttpHeaders { normalizedNames: Map {}, lazyUpdate: null, headers: Map {} },

status: 0,

statusText: 'Unknown Error',

url: 'https://www.example.com/api/get-menu-groups',

ok: false,

name: 'HttpErrorResponse',

message:

'Http failure response for https://www.example.com/api/get-menu-groups: 0 Unknown Error',

error: ....}

Vlada Veljkovic
  • 141
  • 1
  • 6
  • What happens if you try that API from the command line in the server, e.g. using wget ? – David Dec 05 '19 at 13:13
  • It says: "cannot verify certificate....Unable to locally verify the issuer's authority". With --no-check-certificate, returns JSON with data. Note: https works in browsers. – Vlada Veljkovic Dec 05 '19 at 13:59
  • Try adding the following lines after the imports in your `server.ts` file and see if it works: `process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';` ` – David Dec 05 '19 at 14:26
  • No, same thing. Actually, I solved problem with certificate, and now, when I try API from command line, it returns proper json. But, when I try from command line on server (using SSH console) I get 'unable to resolve host address (domain)'. Very strange – Vlada Veljkovic Dec 09 '19 at 14:08
  • For the future, who face the same issue, problem was in bad configuration of some basic Angular Universal files. Follow the instructions from this page and everything will be OK. https://github.com/angular/universal/blob/master/docs/v8-upgrade-guide.md – Vlada Veljkovic Dec 10 '19 at 09:10
  • I have the same issue on my project. But the link you provided doesnt show much, at least that is not my problem. Do you remember what configuration was the issue? – Juano7894 Jul 13 '22 at 19:11

1 Answers1

0

This means that your api return an empty value. There are a lot of problems that can cause this!From your code we can't understand why.

Doflamingo19
  • 1,591
  • 4
  • 12
  • 32