Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node AggregateError is being returned as ETIMEDOUT with no message #6721

Open
kornysietsma opened this issue Nov 27, 2024 · 0 comments
Open

Comments

@kornysietsma
Copy link

Describe the bug

We have an intermittent issue on a service making external HTTPS API calls.
The actual issue isn't particularly relevant, but our problem is that Axios swallowed most of the underlying AggregateError making diagnosis hard.

Node was throwing an AggregateError combining a number of ETIMEDOUT and EHOSTUNREACH errors, contained in a .errors collection - but the parent AggregateError object had a code ETIMEDOUT (Node just uses the code of the first nested error), a blank message, and a name AggregateError

We were logging just the message and the code (as our payloads have sensitive data so we avoided logging the whole Error object - it contains the payload!) and this made it quite difficult to work out that this was more than just a time out.

Eventually I managed to get a stack trace which made things clearer:

AggregateError
    at AxiosError.from (file:///workspace/node_modules/axios/lib/core/AxiosError.js:92:14)
    at RedirectableRequest.handleRequestError (file:///workspace/node_modules/axios/lib/adapters/http.js:620:25)
    at RedirectableRequest.emit (node:events:530:35)
    at RedirectableRequest.emit (node:domain:489:12)
    at eventHandlers.<computed> (/workspace/node_modules/follow-redirects/index.js:49:24)
    at ClientRequest.emit (node:events:518:28)
    at ClientRequest.emit (node:domain:489:12)
    at emitErrorEvent (node:_http_client:101:11)
    at TLSSocket.socketErrorListener (node:_http_client:504:5)
    at TLSSocket.emit (node:events:518:28)
    at Axios.request (file:///workspace/node_modules/axios/lib/core/Axios.js:45:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async requestAuthToken (file:///workspace/dist/src/auth-endpoint-handler.js:58:12)
    at async file:///workspace/dist/src/auth-endpoint-handler.js:25:27

(if it helps we are using Axios 1.7.7 on NodeJS 20.18)

To Reproduce

No response

Code snippet

No response

Expected behavior

It'd be good to have an Error.message indicating that the problem is an AggregateError - or more generally, if wrapping an Error that has no message, setting a message to the name of the underlying error (or some other informative message)

Axios Version

1.7.7

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

20.18.1

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

Running via a Google Cloud Run Function on GCP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant