We recently (in the past two weeks) discovered a very strange behavior in one of our production apps, which ran flawlessly for the last couple of months. There wasn't a deployment in over three months, either.
Somehow, a small portion of our user base (including some of our devs) are getting random 500 Internal Server Errors on PUT/POST requests, but none of them is visible on the backend on the server logs nor in Application insights.
Application insights itself logs those errors from the angular app with Status Code 0, which adds up to the confusion.
Interestingly, Any GET or DELETE request runs without any problem.
The response (body) is nonexistent, which is strange as well.
Somehow, the timing tab in the Chrome dev tools only goes to initial connection, but it appears that no request/response is really handled/shown there, what would match up with the empty response.
That's really all from Application Insights:
We added some custom error logging in the Angular Application, but all the errors are undefined and definitely not coming from our API.
Some other important information:
- Frontend: Angular 17+
- Backend: .NET 8
- IdentityServer for Authentication.
- We use NSwag for the Client Generation.
- Everything is hosted on Azure App Services on different subdomains, CORS is configured and works fine, although we see some error in the console, but we believe this is a consequence of the random 500 error with the missing response headers.
- No Reverse Proxy or API Gateway.
- It miraculously starts working after a couple of minutes/hours, but starts failing multiple times a day.
- A small portion of users are affected.
- Login/Logout doesn't solve the issue.
- Clearing the site's cache doesn't solve the issue.
- A second (different) browser side by side with the same user works!
- It occurs with Chrome, Brave, Edge and Mobile Safari.
- We saw a big spike in Application Insights for this error in the last two weeks, without any changes or deployments.
Are there any known issues with this constellation? We are running out of ideas at this point.
The individual OPTIONS requests are successful:
EDIT: The very same request that fails from Angular works (Dev Tools → Copy → Fetch) in the same tabs browser console.