nodejs / nodejs/undici

BodyTimeoutError: Body Timeout Error | Closing process

Open
#2,997 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
7.7k
Forks
880
Avg merge
2d 16h
Merged PRs (30d)
68

Description

Bug Description

I get this error

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

BodyTimeoutError: Body Timeout Error
    at Timeout.onParserTimeout [as callback] (C:\Users\admin\Documents\GitHub\project\node_modules\undici\lib\dispatcher\client-h1.js:639:28)
    at Timeout.onTimeout [as _onTimeout] (C:\Users\admin\Documents\GitHub\project\node_modules\undici\lib\util\timers.js:20:13)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7) {
  code: 'UND_ERR_BODY_TIMEOUT'
}

Node.js v18.5.0

Once I get this error my app will close. I am catching any errors made by my undici request.

Reproducible By

const res = await request(url, Object.assign(options, this.extraConfiguration)).catch((e) => {
    return resolve({})
})

options = simple headers and request body
this.extraConfiguration is my proxyagent

const { ProxyAgent } = require('undici');

const parsed_url = new URL(proxy);
this.agent = new ProxyAgent({
    uri: proxy
})

if (parsed_url?.username && parsed_url?.password) {
    this.agent = new ProxyAgent({
        uri: proxy,
        auth: Buffer.from(`${parsed_url.username}:${parsed_url.password}`).toString('base64')
    })
}

Expected Behavior

Error should be caught.

Logs & Screenshots

Environment

Windows 11
Node version: 18.5.0

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the request with the ProxyAgent configuration on Windows 11 and Node.js 18.5.0. Read the stack-trace locations in node_modules/undici/lib/dispatcher/client-h1.js and node_modules/undici/lib/util/timers.js, then verify whether the request catch handles BodyTimeoutError. Done means the reported timeout is caught without closing the process.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.