Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Should support undici timeout err.code #33

@yohay-ma

Description

@yohay-ma

🐛 Bug Report

undici timeout err.code=UND_ERR_REQUEST_TIMEOUT is not handled properly, therefore instead of getting error 504 I get error 500

We need to add in index.js line 88 the undici timeout error code as well:

} else if (err.code === 'ECONNRESET' || err.code === 'UND_ERR_REQUEST_TIMEOUT' ) {

To Reproduce

Steps to reproduce the behavior:
in undici set the time out to a low number:

    undiciOptions: {
      connections: 4000,
      pipelining: 20,
      proxyCacheSize: 50,
      proxyCacheTtl: 1000 * 60 * 60 * 24,
      requestTimeout: 1000
    }

in test server open a route with sleep:
for example:

  .get('/api/v1/my-route/timeout', async (req, res) => {
    await sleep(3000);
    res.end();
  })

Expected behavior

Should handle timeout code from undici

Note: I think the following error codes should also be added: ESOCKETTIMEDOUT and ETIMEDOUT

Your Environment

  • node version: 12
  • fast-proxy version: 1.6.3
  • os: Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions