Skip to content

Commit f345198

Browse files
bloveclaude
andauthored
chore(diag): expose hasDatabaseUrl + instanceId in _proxy_debug (#318)
The Phase 3 rate limit is partially working in production — 12 streaming requests resulted in 7 DB inserts but no 429s. Theory: some Vercel function instances cold-start without DATABASE_URL populated and silently fail-open for their lifetime. This commit adds three fields to the /api/_proxy_debug response so we can confirm: - hasDatabaseUrl: whether the env var is visible at runtime - rateLimitConfigured: whether the proxy was wired with the hook - instanceId: a per-instance random id, so multiple curls can show whether they hit the same instance or different ones Once verified, this commit can stay (cheap) or be reverted as preferred — the cost is 4 lines in the debug response. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e5bc0f2 commit f345198

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

scripts/langgraph-proxy.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ export function createProxyHandler(config: ProxyConfig = {}): (req: VercelReques
105105
query: req.query,
106106
hasApiKey: !!apiKey,
107107
apiKeyPrefix: apiKey.substring(0, 10),
108+
hasDatabaseUrl: !!process.env['DATABASE_URL'],
109+
rateLimitConfigured: !!config.checkRateLimit,
110+
instanceId: (() => {
111+
const g = globalThis as { __instanceId?: string };
112+
if (!g.__instanceId) g.__instanceId = Math.random().toString(36).slice(2, 10);
113+
return g.__instanceId;
114+
})(),
108115
});
109116
return;
110117
}

0 commit comments

Comments
 (0)