Skip to content

Commit ea3f0c0

Browse files
mini2sclaude
andauthored
fix: guard axios socket keepalive call (#1283)
Prevent VS Code extension runtime crashes when axios receives a socket-like object without setKeepAlive. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 34e4659 commit ea3f0c0

3 files changed

Lines changed: 32 additions & 32 deletions

File tree

patches/axios@1.16.0.patch

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/lib/adapters/http.js b/lib/adapters/http.js
2+
index 252c7d87b908a0bef3adf5a4f7ce4174d7e800e8..e098a7ec72095d0236a17a705922b3d0585d19b3 100755
3+
--- a/lib/adapters/http.js
4+
+++ b/lib/adapters/http.js
5+
@@ -1064,7 +1064,9 @@ export default isHttpAdapterSupported &&
6+
7+
req.on('socket', function handleRequestSocket(socket) {
8+
// default interval of sending ack packet is 1 minute
9+
- socket.setKeepAlive(true, 1000 * 60);
10+
+ if (socket.setKeepAlive) {
11+
+ socket.setKeepAlive(true, 1000 * 60);
12+
+ }
13+
14+
// Install a single 'error' listener per socket (not per request) to avoid
15+
// accumulating listeners on pooled keep-alive sockets that get reassigned

pnpm-lock.yaml

Lines changed: 13 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ overrides:
6161
"js-cookie@<=3.0.5": ">=3.0.7"
6262
"qs@>=6.11.1 <=6.15.1": ">=6.15.2"
6363
"tmp@<0.2.6": ">=0.2.6"
64-
"axios@>=1.0.0 <1.16.0": ">=1.16.0"
64+
"axios@>=1.0.0 <1.16.0": "1.16.0"
6565
"vitest": "3.2.6"
6666
"@ai-sdk/provider-utils": "4.0.27"
67+
68+
patchedDependencies:
69+
axios@1.16.0: patches/axios@1.16.0.patch

0 commit comments

Comments
 (0)