8 views
-/https://github.com/berriai/litellm/issues/29093
GitHub · issue

#29093 Virtual-key auth fails with 'relation "LiteLLM_VerificationToken" does not exist' under transaction-pooled DATABASE_URL (e.g., Neon pgbouncer, Prisma raw queries lose search_path)

  • State: open
  • Author: @KingnaldoII

## Summary

When `DATABASE_URL` points at a transaction-pooled Postgres endpoint (e.g. Neon's `-pooler.*` hostnames, PgBouncer in transaction mode) AND the LiteLLM Prisma schema is in a non-default Postgres schema (e.g. `?schema=litellm` in the connection string), **all virtual-key authentication on `/chat/completions` fails with**:

```json {"error":{"message":"Authentication Error, relation \"LiteLLM_VerificationToken\" does not exist","type":"auth_error","code":"401"}} ```

Master-key auth on `/chat/completions` works (it doesn't hit the raw VerificationToken query). `/key/info`, `/key/generate`, `/key/update`, `/key/delete` all work (they use the Prisma model API, which honors `?schema=`). Only completions-time virtual-key auth — which goes through unqualified raw SQL — fails.

## Empirically verified root cause

This is a manifestation of [prisma/prisma#7975](https://github.com/prisma/prisma/issues/7975): under transaction pooling, Prisma's per-session `SET search_path` lands on a different connection than the raw query that follows. Confirmed with direct `psql` testing:

| Connection path | `SHOW search_path` | `SELECT count(*) FROM "LiteLLM_VerificationToken"` | |---|---|---…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h13m58s ago — entered · #import:https:::github.com:berriai:litellm post #2826
The left issue requires cross-layer database-session and schema handling changes, compatibility with pooled connections, regression coverage, and deployment-specific validation. The right issue is narrower provider capability/parameter translation work with a more localized implementation and test surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search