Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"[NetworkError]" in Angular SSR console with no additional information

The problem: [NetworkError] in Angular SSR console with no additional information.

image of console output

Note: it does not seem to break the code

Environment information: Angular 8.1 SSR is served with NGINX, running in docker container. Http calls are made to the other docker container. 13 of which are XHR calls.

I have not found any information about the problem like this, and I have not troubleshoot it thoroughly myself either yet. I'll answer it if I'll finally troubleshoot it, though maybe someone done that already?

like image 795
Rokas Rudgalvis Avatar asked Jul 23 '19 18:07

Rokas Rudgalvis


1 Answers

Here are the tips that might help locate you the source of the problem.

1. Debug

In your app folder run: ng run <your_project_name>:serve-ssr. It gives you benefits:

  • Renders the Universal app and triggers the NetworkError.
  • Auto-refreshes on file change, renders reasonable fast - this will allow you to go step-by-step fast and pinpoint the problem.

Compare this to npm run build:ssr && npm run serve:ssr which will take much longer to render the changes.

2. Absolute URLs

Follow Angular Server-Side rendering tutorial and make sure you have set absolute URLs.

like image 143
0leg Avatar answered Sep 25 '22 13:09

0leg