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

Request TIMEOUT ignores the config.timeout value #245

Open
kailashyogeshwar85 opened this issue Feb 21, 2024 · 2 comments
Open

Request TIMEOUT ignores the config.timeout value #245

kailashyogeshwar85 opened this issue Feb 21, 2024 · 2 comments
Assignees

Comments

@kailashyogeshwar85
Copy link

I have configured request timeout using nestjs http module with below configuration

  timeout: 45000
  maxRedirects: 5

Upstream server is sending response with a delay of 6 seconds

Response

TIMEOUT_REQ: 5.007s
Error: timeout of 45000ms exceeded
    at createError (/user/projects/hola/node_modules/axios/lib/core/createError.js:16:15)
    at RedirectableRequest.handleRequestTimeout (/user/projects/hola/node_modules/axios/lib/adapters/http.js:266:16)
    at Object.onceWrapper (node:events:633:26)
    at RedirectableRequest.emit (node:events:518:28)
    at RedirectableRequest.emit (node:domain:488:12)
    at ClientRequest.eventHandlers.<computed> (/user/projects/hola/node_modules/follow-redirects/index.js:13:24)
    at ClientRequest.emit (node:events:518:28)
    at ClientRequest.emit (node:domain:488:12)
    at Socket.emitRequestTimeout (node:_http_client:840:9)
    at Object.onceWrapper (node:events:632:28)
    at Socket.emit (node:events:530:35)
    at Socket.emit (node:domain:488:12)
    at Socket._onTimeout (node:net:589:8)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  config: {
    url: 'http://localhost:3000/timeout',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'x-correlation-id': 'N2n9HP5Lx',
      'Content-Type': 'application/json; charset=UTF-8',
      'User-Agent': 'axios/0.21.0'
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 45000,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    maxRedirects: 5,
    validateStatus: [Function: validateStatus],
    data: undefined
  },

However when setting timeout to 0 it never times out the request.

@RubenVerborgh
Copy link
Collaborator

Thanks, could you please provide code to reproduce?

@Pjrich1313

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants