Problem
Getting:
Setup
It is difficult to pin-point the reason and provide details. In a nutshell there is a Angular + Express.js app, MySQL for the database, Nginx for a proxy server, using Docker to glue everything together.
- The problem happens when request takes ~110+ ms to complete.
- Only PUT, POST, DELETE methods are affected (GET works fine).
- The browser shows a request got canceled, but the actual code work (e.g. Express.js completes the logic and updated MySQL database).
- Verified on Chrome and Firefox (so not a browser problem).
So, whenever any long-running async task is used (e.g. setTimeout(() => {}, 1000), the request in the browser gets canceled status.
So trying to figure out. Is it an Express.js setting? NginX setting? Angular HttpClient?
TO summarize, everything works under the hood. But the browser receives status canceled - which makes impossible to track the action outcome and notify the user operation has been completed.
Update
Nginx log returns:
nginx_1 | 172.18.0.1 - - [01/Aug/2020:12:49:19 +0000] "PUT /api/tags/update HTTP/1.1" 499 0 "http://localhost:8081/tags" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Angular TypeScript code looks like this:
this.httpClient
.put<Tag>(`/api/tags/${slug}`, data)
.pipe(takeUntil(this.unsubscribe$))
.subscribe();
