Connect to postgres from Workers through tunnel. Is it still possible?
https://blog.cloudflare.com/introducing-socket-workers
https://github.com/cloudflare/worker-template-postgres
Based on this blog post and the template on github, it looks like they used a custom driver to accomplish that. However, the blog and repository were last updated three years ago, and I think things have changed a lot now.
I tried running this sample, but the dependencies were old (wrangler v1) and I didn't know how to migrate them.
Is it currently possible to achieve the same? The purpose is to securely connect to on-premises postgres from workers. hyperdrive requires a publicly accessible postgres, so it doesn't seem fit for this purpose.
The Cloudflare Blog
Making connections with TCP and Sockets for Workers
The ability to make TCP and QUIC client connections from within Workers and Durable Objects, as well as the ability to connect to Workers over TCP and QUIC without using HTTP, will be coming to Cloudflare Workers. However, there is much to consider and a lot to do to make it happen. Here’s a peek at what we’re working on.
GitHub
GitHub - cloudflare/worker-template-postgres: Reference demo and mo...
Reference demo and modified PostgreSQL driver to connect Cloudflare Workers to a relational database. - cloudflare/worker-template-postgres
2 Replies
https://github.com/cloudflare/cloudflare-docs/pull/9561
Documentation regarding this template has been removed in PR 9561
https://github.com/eai04191/worker-template-postgres/commit/73b1cc84b9110b6b9f63f5061814e8b6116f3d88
I made some updates and it works up to wrangler 3, but I couldn't get any results beyond internal error.