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. Environment: Platform: Cloudflare Hyperdrive Connection Method: Direct Postgres connection (port 5432) OS: macOS IPv4 Add-on: Enabled 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] 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.
No description
3 Replies
garyaustin
garyaustin2h ago
Does your password have special characters? Looks like you are supplying a full URL string there which means they have to be URL encoded or use a password without them At the bottom of database settings tab is a list of blocked IP's based on failtoban. Otherwise there is no IP blocking. I assume Hyperdrive works with IPv6 ports as that is what you are using. IPv4 is the session pooler port (still 5432).
Roger
RogerOP2h ago
Thanks for the clarification! My password doesn't contain special characters, so URL encoding shouldn't be an issue. I've also checked the Network Bans section in my Database Settings tab, and I don't see any Cloudflare IPs blocked there. Given that: No special characters in password No blocked IPs Hyperdrive still shows "Server returned error and closed connection [code: 2015]" Are there any other settings I should check, or could this be related to how Hyperdrive authenticates with Postgres?
No description
garyaustin
garyaustin1h ago
You might try the session pooler port from the connections tab in case their software is IPv4 only (which I'm skeptical of). Otherwise I have nothing for you.

Did you find this page helpful?