Skip to content

Commit 797359f

Browse files
authored
fix(opencode): patch gcp metadata warning leak (#29431)
1 parent 034298c commit 797359f

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

bun.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
145145
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch",
146146
"virtua@0.49.1": "patches/virtua@0.49.1.patch",
147-
"@ai-sdk/xai@3.0.82": "patches/@ai-sdk%2Fxai@3.0.82.patch"
147+
"@ai-sdk/xai@3.0.82": "patches/@ai-sdk%2Fxai@3.0.82.patch",
148+
"gcp-metadata@8.1.2": "patches/gcp-metadata@8.1.2.patch"
148149
}
149150
}

patches/gcp-metadata@8.1.2.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/build/src/index.js b/build/src/index.js
2+
--- a/build/src/index.js
3+
+++ b/build/src/index.js
4+
@@ -323,6 +323,10 @@ async function isAvailable() {
5+
if (process.env.DEBUG_AUTH) {
6+
console.info(err);
7+
}
8+
+ // Promise.any() rejects with AggregateError when neither metadata host
9+
+ // is available. This is expected outside GCP, not a warning condition.
10+
+ if (err instanceof AggregateError)
11+
+ return false;
12+
if (err.type === 'request-timeout') {
13+
// If running in a GCP environment, metadata endpoint should return
14+
// within ms.

0 commit comments

Comments
 (0)