I am using the Fetch API introduced in NodeJS 18 to access an API. However, the request always times out after 10 seconds with the following error message.
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:8522:28)
at node:internal/deps/undici/undici:8480:50
at Immediate._onImmediate (node:internal/deps/undici/undici:8509:37)
at processImmediate (node:internal/timers:478:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
I want to INCREASE the time before the fetch request times out, however I have not been able to find way to do this with the built-in NodeJS API.