From 654a9e622759f3a3bb06ee53b25ab2b00fc636ef Mon Sep 17 00:00:00 2001 From: Johan Preynat Date: Thu, 14 Mar 2024 20:35:00 +0100 Subject: [PATCH] Increase getDocument timeout to 20s to prevent failing while the API is normalizing documents (#264) --- src/lib/api.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/api.ts b/src/lib/api.ts index 8d8938da1..b2b7f046c 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -559,6 +559,12 @@ export const getDocument = cache( ); return cacheResponse(response, immutableCacheTtl_7days); }, + { + // Temporarily allow for a longer timeout than the default 10s + // because GitBook's API currently re-normalizes all documents + // and it can take more than 10s... + timeout: 20 * 1000, + }, ); /**