From 16a616f112b1bab663c5487c6cd9c0814b13dc44 Mon Sep 17 00:00:00 2001 From: Andrew Rumble Date: Tue, 24 Mar 2026 11:58:40 +0100 Subject: [PATCH] Merge pull request #32395 from overleaf/ar-more-information-on-long-requests [fetch-utils] more information on long requests GitOrigin-RevId: 716620fa95fcfbe563ad0a3728cebd09509b03f5 --- libraries/fetch-utils/index.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libraries/fetch-utils/index.js b/libraries/fetch-utils/index.js index 57cce2ce85..8a740fe7b0 100644 --- a/libraries/fetch-utils/index.js +++ b/libraries/fetch-utils/index.js @@ -188,16 +188,25 @@ function parseOpts(opts, url) { if (opts.signal) { detachSignal = abortOnSignal(abortController, opts.signal) } else { + let overTimeoutStart + const stack = new Error().stack const timeout = setTimeout(() => { - if (logger) { - logger.warn( - { url, method: opts.method ?? 'GET' }, - 'Fetch request did not complete within 120 seconds' - ) - } + overTimeoutStart = process.hrtime.bigint() }, 120000) detachSignal = () => { clearTimeout(timeout) + if (overTimeoutStart && logger) { + logger.warn( + { + url, + method: opts.method ?? 'GET', + overTimeoutMs: + Number(process.hrtime.bigint() - overTimeoutStart) / 1e6, + stack, + }, + 'Fetch request did not complete within 120 seconds' + ) + } } } if (opts.body instanceof Readable) {