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: ....}

6
  • What happens if you try that API from the command line in the server, e.g. using wget ? Commented Dec 5, 2019 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. Commented Dec 5, 2019 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'; ` Commented Dec 5, 2019 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 Commented Dec 9, 2019 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. github.com/angular/universal/blob/master/docs/… Commented Dec 10, 2019 at 9:10

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

How can it be possible when there are values, rendered on page?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.