fix(glmt): pass env vars to proxy subprocess

The spawn() call was missing the env option, so ANTHROPIC_AUTH_TOKEN
and ANTHROPIC_BASE_URL were not being passed to the proxy subprocess.
This caused 401 Unauthorized errors.
This commit is contained in:
kaitranntt
2025-12-07 23:09:06 -05:00
parent 077a406df6
commit e17a068a58
+6
View File
@@ -75,8 +75,14 @@ async function execClaudeWithProxy(
const proxyPath = path.join(__dirname, 'glmt', 'glmt-proxy.js');
const proxyArgs = verbose ? ['--verbose'] : [];
// Use process.execPath for Windows compatibility (CVE-2024-27980)
// Pass environment variables to proxy subprocess (required for auth)
const proxy = spawn(process.execPath, [proxyPath, ...proxyArgs], {
stdio: ['ignore', 'pipe', verbose ? 'pipe' : 'inherit'],
env: {
...process.env,
ANTHROPIC_AUTH_TOKEN: apiKey,
ANTHROPIC_BASE_URL: settings.env.ANTHROPIC_BASE_URL,
},
});
// 3. Wait for proxy ready signal (with timeout)