We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c87b9a7 commit 310867dCopy full SHA for 310867d
1 file changed
packages/ai/src/env-api-keys.ts
@@ -89,8 +89,11 @@ function getProcEnv(key: string): string | undefined {
89
if (procEnvCache === null) {
90
procEnvCache = new Map();
91
try {
92
- const { readFileSync } = require("node:fs") as typeof import("node:fs");
93
- const data = readFileSync("/proc/self/environ", "utf-8");
+ const fsModule = loadNodeBuiltinModule(NODE_FS_SPECIFIER) as typeof import("node:fs") | null;
+ if (!fsModule) {
94
+ return undefined;
95
+ }
96
+ const data = fsModule.readFileSync("/proc/self/environ", "utf-8");
97
for (const entry of data.split("\0")) {
98
const idx = entry.indexOf("=");
99
if (idx > 0) {
0 commit comments