Cloudflare DevelopersCD
Cloudflare Developers14mo ago
1 reply
kchro3

Also, I'm having trouble connecting with

Also, I'm having trouble connecting with a local postgres DB when using hyperdrive.

I've tried both using the env variable & the localConnectionString, but I keep getting this error:

✘ [ERROR] Error: write CONNECT_TIMEOUT <>.hyperdrive.local:5432

      at oW
  (file:///Users//workspace//node_modules/postgres/cf/src/connection.js:259:20)
      at n
  (file:///Users//workspace//node_modules/postgres/cf/src/connection.js:1035:8)
      at cachedError
  (file:///Users//workspace//node_modules/postgres/cf/src/query.js:170:23)
      at new Query
  (file:///Users//workspace//node_modules/postgres/cf/src/query.js:36:24)
      at Object.He [as sql]
  (file:///Users//workspace//node_modules/postgres/cf/src/index.js:113:11)
      at getTemplatesV2

    code: 'CONNECT_TIMEOUT',
    errno: 'CONNECT_TIMEOUT',
    address: '<>.hyperdrive.local',
    port: 5432
  }


app code:
    return postgres(env.HYPERDRIVE.connectionString, { prepare: false });


wrangler.toml:
[[hyperdrive]]
binding = "HYPERDRIVE"
id = "..."
localConnectionString = "postgres://postgres:password@localhost:5432/postgres"


I can connect to the DB using that localConnectionString but without using Hyperdrive
Was this page helpful?