Does postgres connection in worked require hyperdrive?

For Workes & Pages, what is the name of the domain?

example.com

What is the error number?

500

What is the error message?

“Error: Connection terminated unexpectedly”

What is the issue or error you’re encountering

Connection to postgres db hosted in supabase doesn’t work

What steps have you taken to resolve the issue?

Using hyperdrive, but is it always required? is not clear from the postgres tutorial in the workers.

What are the steps to reproduce the issue?

Followed the steps described here:

Connection always terminates before even getting to the query call.
In that example it doesn’t mention hyperdrive, but in the Connect to databases section it mentions hyperdrive:

Do we always need hyperdrive? is this required only for postgres hosted in supabase connections?

Hello there,

Allow me to clarify that with the product team. I’ll keep you posted.

Hello again @rodrigo17,

Thanks for your patience while we are reviewing your request.

Per my recent interaction with the product team, you will almost always want Hyperdrive.

Raw TCP sockets don’t do any kind of connection pooling and the Worker would have to reconnect to the database on every request.

1 Like

While hyperdrive is useful, many services like Neon and Supabase provide their own connection pooling that you could use (and we do in production without issue with Neon).

By using Hyperdrive, you would benefit from additions such as caching, though.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.