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

Uses ECONNABORTED for timeouts instead of ETIMEDOUT #1543

Closed
jwbay opened this issue May 17, 2018 · 10 comments
Closed

Uses ECONNABORTED for timeouts instead of ETIMEDOUT #1543

jwbay opened this issue May 17, 2018 · 10 comments

Comments

@jwbay
Copy link

jwbay commented May 17, 2018

Summary

Axios seems to set a code of ECONNABORTED when a request times out:

reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',

This makes it difficult to tell when a request actually timed out vs. being aborted in a different way:

reject(createError('Request aborted', config, 'ECONNABORTED', request));

Should ETIMEDOUT be used instead?

Context

  • axios version: 0.18.0
@gillib
Copy link

gillib commented Oct 20, 2018

This is very important to us as well. but please add this to http adapter as well as xhr

@lundn
Copy link

lundn commented Feb 1, 2019

Would be very nice to have!

@9-lives
Copy link

9-lives commented Jul 30, 2019

how is it going?

@Kameecoding
Copy link

Kameecoding commented Nov 25, 2019

{
  "message": "timeout of 1ms exceeded",
  "name": "Error",
  "stack": "Error: timeout of 1ms exceeded\n at createError (webpack-internal:///./node_modules/axios/lib/core/createError.js:16:15)\n at XMLHttpRequest.handleTimeout (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:89:14)",
  "config": {
    "url": "redacted",
    "method": "get",
    "headers": { "Accept": "application/json, text/plain, */*" },
    "transformRequest": [null],
    "transformResponse": [null],
    "timeout": 1,
  },
  "code": "ECONNABORTED"
} 

as a workaround, you should be able to check the message or stack for timeout

@leolivier
Copy link

+1

@eddyson1006
Copy link

+1

@jasonsaayman
Copy link
Member

Closing in favour of #2710

@adamtheadmin
Copy link

The ETIMEDOUT comes from node internal API's not axios'

@dvicory
Copy link

dvicory commented May 19, 2022

I don't see how this is related to #2710, but I do agree this should be closed. For us, this functionality is covered with clarifyTimeoutError.

@vaibhavgupta-bst
Copy link

To get ETIMEDOUT status instead of ECONNABORTED, set transitional.clarifyTimeoutError = true in the axios request config. Below is the implementation in axios module
image

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