score:2

Accepted answer

based on your excellent description and detective work, it's clear that the problem is between your node app and the other domain. the other domain is throwing an error and your proxy has no choice but to say that there's an error on the server. that's why it's always throwing a 500-series error, the network request failed error that you're seeing.

it's an intermittent problem, so the error is inconsistent. it's a waste of your time to continue to look at the browser because the problem will have been created beyond that, either in your proxy translating that request or on the remote server. you have to find that error.

here's what i'd do... implement brute-force logging in your node app. you can use bunyan, or winston or just require(fs) and write out to some file when an error occurs. then look at the results. only log it out when the response code from the other server is in the 400 or 500 ranges. log the request object and the response object.

something like this with bunyan:

fetch(urltoremoteserver)
.then(res => res.json()) 
.then(res => whateverelseyouredoing(res))
.catch(err => {
  // get the request & response to the remote server
  log.info({request: req, response: res, err: err});
});

where the res in this case is the response we just got from the other domain and req is our request to them.

the logs on your azure server will then have the entire request and response. from this you can find commonalities. and (🤞) the cause of the problem.


Related Query

More Query from same tag