forwardemail / forwardemail/superagent

request error not returning 504 status or response details

Open
#1,601 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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](https://visionmedia.github.io/superagent/#request-basics)?

Contributor guide

Open the contributing guide

Research direction

Start with the POST request and catch handler shown in the issue, then read the linked Request Basics documentation for the expected error fields. Reproduce the 504 from an AWS API Gateway endpoint timing out after 29 seconds and compare the browser Network response with the caught error; done means the missing status and response details are explained or corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.