Skip to content

Commit b3027cf

Browse files
authored
fix: patch node-fetch to a better user-agent value (#7640)
1 parent c5a231e commit b3027cf

5 files changed

Lines changed: 141 additions & 15 deletions

File tree

.changeset/pink-trees-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperlane-xyz/infra': patch
3+
---
4+
5+
Patched node-fetch@2.7.0 to avoid 429 errors with Safe API, reverting from premature upgrade to node-fetch@3

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
"underscore": "^1.13",
5454
"undici": "^5.11",
5555
"@babel/parser": "^7.22.7",
56-
"@typechain/ethers-v5": "11.1.2",
57-
"node-fetch": "^3.3.2"
56+
"@typechain/ethers-v5": "11.1.2"
5857
},
5958
"patchedDependencies": {
60-
"typechain@8.3.2": "patches/typechain@8.3.2.patch"
59+
"typechain@8.3.2": "patches/typechain@8.3.2.patch",
60+
"node-fetch@2.7.0": "patches/node-fetch@2.7.0.patch"
6161
}
6262
}
6363
}

patches/node-fetch@2.7.0.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/lib/index.js b/lib/index.js
2+
index 567ff5da58e83683bec0ea9e86221041ddf9435f..b026c23025b3f53f2ee778f54e6d79238d45db7c 100644
3+
--- a/lib/index.js
4+
+++ b/lib/index.js
5+
@@ -1352,7 +1352,7 @@ function getNodeRequestOptions(request) {
6+
7+
// HTTP-network-or-cache fetch step 2.11
8+
if (!headers.has('User-Agent')) {
9+
- headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');
10+
+ headers.set('User-Agent', 'node-fetch');
11+
}
12+
13+
// HTTP-network-or-cache fetch step 2.15

0 commit comments

Comments
 (0)