Skip to content

chore(diag): expose hasDatabaseUrl + instanceId in _proxy_debug#318

Merged
blove merged 1 commit into
mainfrom
claude/diag-proxy-debug-rate-limit
May 14, 2026
Merged

chore(diag): expose hasDatabaseUrl + instanceId in _proxy_debug#318
blove merged 1 commit into
mainfrom
claude/diag-proxy-debug-rate-limit

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 14, 2026

Summary

Phase 3 rate-limit is partially working in production. 12 streaming requests inserted 7 rows but never returned 429. The most likely cause is some Vercel function instances cold-start without `DATABASE_URL` populated and silently fail-open for their lifetime.

This PR adds three diagnostic fields to `/api/_proxy_debug`:

  • `hasDatabaseUrl` — is the env var visible at runtime
  • `rateLimitConfigured` — was the proxy wired with the hook
  • `instanceId` — random id per function instance

By hitting `/api/_proxy_debug` repeatedly, we can confirm whether multiple instances are running and whether DATABASE_URL is consistently set on all of them.

Stays in production after diagnosis (cheap, 4 lines).

Test plan

  • All 10 langgraph-proxy unit tests still pass
  • After merge: `for i in {1..20}; do curl -s https://demo.cacheplane.ai/api/_proxy_debug | jq '{hasDatabaseUrl, instanceId}'; done` — see if `hasDatabaseUrl` is ever `false` or if `instanceId` varies

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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 14, 2026 7:36am

Request Review

@blove blove merged commit f345198 into main May 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant