Skip to content

Commit 5c1cd20

Browse files
fix: Disable connection keepalive when using node-fetch (#643)
Disable HTTP connection keepalive when using `node-fetch` to fetch the registry as it may fail with newer Node versions, when the content is gzipped. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Single-header change to build-time HTTP behavior only; no runtime app logic, auth, or data model changes. > > **Overview** > Adds **`Connection: close`** to the shared `HEADERS` object in `gatsby-node.ts` so every **`node-fetch`** call during the Gatsby build (registry, signature, cached registry, and stats) closes the TCP connection instead of reusing keep-alive pools. > > This targets intermittent **registry fetch failures on newer Node versions** when persistent connections are left open. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 33e9924. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent de7b9e1 commit 5c1cd20

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

gatsby-node.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const PUBLIC_KEY =
6464
const STATS_URL = 'https://data.snaps.metamask.io/';
6565

6666
const HEADERS = {
67+
Connection: 'close',
6768
'User-Agent':
6869
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
6970
};

0 commit comments

Comments
 (0)