Hyperdrive Connection Failing with Error Code 2015 - "Server returned error and closed connection"
I'm trying to set up Cloudflare Hyperdrive to connect directly to my Supabase Postgres database (bypassing the REST API to avoid Cloudflare bot detection issues), but I'm getting a connection error.
What I'm trying to achieve: Connect Cloudflare Hyperdrive to my Supabase Postgres database using the direct connection string for lower latency and to bypass WAF bot detection.
Connection string format used: postgresql://postgres:[PASSWORD]@db.[PROJECT-ID].supabase.co:5432/postgres
Error message:
Failed to connect to the provided database: Server returned error and closed connection [code: 2015]
Failed to connect to the provided database: Server returned error and closed connection [code: 2015]
What I've tried: - Creating Hyperdrive config via Cloudflare dashboard - same error - Creating via Wrangler CLI (npx wrangler hyperdrive create) - same error - Verified the connection string format matches Supabase docs - Enabled IPv4 add-on in Supabase project settings
Questions: - Does Supabase block direct connections from Cloudflare Hyperdrive IP ranges? - Is there a specific connection string format or authentication method required for Hyperdrive? - Are there any firewall/security settings I need to adjust in my Supabase project settings? - Should I be using the transaction pooler (port 6543) instead of direct connection (port 5432)?
Additional context: Following the implementation plan in Cloudflare's Supabase + Hyperdrive docs, which recommends using port 5432 since Hyperdrive provides its own transaction-mode pooling.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.