cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.74k stars 732 forks source link

🐛 BUG: Unable to create Hyperdrive to PostgreSQL database hosted on Fly.io #4106

Closed lithdew closed 1 year ago

lithdew commented 1 year ago

Which Cloudflare product(s) does this pertain to?

Other

What version(s) of the tool(s) are you using?

3.10.1

What version of Node are you using?

No response

What operating system are you using?

Mac

Describe the Bug

$ npx wrangler hyperdrive create database --connection-string="$DATABASE_URL" 
🚧 Creating 'database'

✘ [ERROR] A request to the Cloudflare API (/accounts/(OMITTED)/hyperdrive/configs) failed.

  Failed to connect to database using the provided information: failed to connect to
  `host=(OMITTED) user=postgres database=postgres`: failed to write startup message
  (write failed: EOF) [code: 2015]

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

The PostgreSQL instance itself is hosted on a public IPv4 address on Fly.io. I have tested connectivity using psql, and also have successfully connected directly to this instance using cloudflare workers. The issue only occurs when creating a Hyperdrive over the instance itself.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

elithrar commented 1 year ago

We’d need a bit more detail here:

… so we can attempt to reproduce.

lithdew commented 1 year ago

The main issue here was that my PostgreSQL instance was not protected with TLS, and Hyperdrive only supports instances protected with TLS. Closing.

smorimoto commented 1 year ago

Direct IP connection is surely not supported. In other words, you should be able to use it without any special setup with the *.fly.dev domain 🙂