superagent icon indicating copy to clipboard operation
superagent copied to clipboard

request error not returning 504 status or response details

Open DavidFlorin opened this issue 4 years ago • 0 comments

I have a POST request similar to:

superagent.post(url)
      .set('Content-Type', 'application/json')
      .set('Accept', 'application/json')
      .set('Authorization', `Bearer ${accessToken}`)
      .query(query)
      .send(body)
      .then(() => {
        //...
      })
      .catch((error) => {
        console.log('response', error.response)
        console.log('status', error.status)
        console.log('error', error)
        //...
      })
  • the request is done on a AWS API Gateway endpoint which is closing the call with a timeout error after 29 sec
  • the server response (in Chrome DevTools / Network) contains the 504 status code:
image
  • next logs (from the call above) are printed to the console:
image

Why there is no response or status attribute on the error as in documentation?

DavidFlorin avatar Oct 15 '20 14:10 DavidFlorin