Anyone successfully use Bun 1.2's Postgres support to connect to a Supabase Postgres database?
I just tried it out, but I am not having much luck. I just followed the happy path sample in the Bun SQL docs:
The connection string was provided via the
POSTGRES_URL
command line variable and was set to the value you get in the Project Settings page when using the Connect button and copying the Direct Connection connection string in the Connection String section tab of the Connect dialog. The DB password was correctly replaced with the placeholder.
Trying this I run into this error:
Wondering if any fellow Supabase and Bun enjoyers experimented with this and got it to work?
I should mention the Supabase support checkbox in the SQL tracking query here is not checked yet: https://github.com/oven-sh/bun/issues/15088
But perhaps that means the Bun folks haven't tried it yet but someone in this community might have?
Thank you4 Replies
The direct connection will only work in ipv6 mode from your device,OS,router,network provider to Supabase. You might try the session pooler option which is ipv4 unless you are sure you have ipv6 support.
Edit: and just looked at your linked list and no idea on those features without research.
Your error implies though you are not even connecting.
This helped me advance past the original error, but now with the Session pooler connection string, the error I get is this:
I tried adding
?sslmode=prefer
at the end of the connection string and it gave me this:
I realized my DB was disallowing all direct connections so I used the https://supabase.com/dashboard/project/_/settings/database Network restrictions section to white-list my IPv4. Thank youNo help from me on SSL other than the settings.

Sorry I was typing the message as I was trying things. Ultimately I meant to say you've helped me solve it and what were the steps. I am happy with SSL being enforced and all IPs but my whitelisted one being banned. Now the setup works knowing I need to use the Session Pooler connection string and white-list my IPv4.