Is Hyperdrive able to resolve ipv6 only servers?

Is Hyperdrive able to resolve ipv6 only servers?
14 Replies
jonfanz
jonfanz12mo ago
👋 (cc: @divided421) Jon from Prisma here. Accelerate does support Mongo. Agree that we could make it more obvious though, it's only briefly mentioned here
xatxat
xatxat12mo ago
hi, i'm occasionally getting "could not get connection from the pool"-errors with one of my hyperdrive connections. it seems to happen quite randomly, maybe about one in ten times. any advice how to debug this?
morpig
morpig12mo ago
are you experiencing it only recently? or from day 0 since deploy?
xatxat
xatxat12mo ago
i experienced it on a worker that was last deployed about two weeks ago. however, i just re-deployed that worker and so far the error didn't happen anymore. in my code i'm setting up a pool of with 10 connections max:
const dialect = new PostgresDialect({
pool: new Pool({
connectionString,
max: 10,
}),
});
const dialect = new PostgresDialect({
pool: new Pool({
connectionString,
max: 10,
}),
});
however, i'm not sure if i should even be setting up a pool? since hyperdrive itself acts as a connection pool? maybe i should reduce max connections to 1?
kian
kian12mo ago
you'd be better off just using a single client
xatxat
xatxat12mo ago
thx, then i'll configure the pool with max: 1. afaik kysely needs to be initialized with a pool instance.
Colin
Colin12mo ago
hey y'all - wanted to talk about the localConnectionString in wrangler.toml with Hyperdrive I've seen a couple other messages in here saying people didn't think it should be stored in plain text like this/might contain secrets (password/endpoint)/etc., and at least for my use case, I agree. I believe the intention on CF's side is that this shouldn't ever be a string that has secrets + you should only point to a local Postgres instance (IE so it'd be postgres://localhost, or something that's fine to commit to VCS), but there's definitely been times where I need to connect to a remote dev database. For example, AWS Aurora-exclusive features that don't have a local equivalent/emulator. The current model doesn't seem to support this very well, as you're forced to either put the sensitive string in wrangler.toml or make something akin to a OVERRIDE_DB_CONNECTION_STRING env var, and handle choosing between hyperdrive.connectionString or the override in your app. Even if you do make an env var/some other way to sidestep the builtin solution, wrangler still requires a localConnectionString to be set in wrangler.toml. Is there any chance of a better way to do handle this / am I missing something to make local dev easier?
elithrar
elithrar12mo ago
This should work.
carlos-alberto
carlos-alberto12mo ago
Hey! Are there plans to add hyperdrive support to the cloudflare terraform provider?
kian
kian12mo ago
It's publicly documented (https://developers.cloudflare.com/api/operations/create-hyperdrive) so it just needs to be added into cloudflare-go and cloudflare-terraform-provider. You can open an issue at https://github.com/cloudflare/terraform-provider-cloudflare/issues to request it
Sam
SamOP12mo ago
Can confirm 👍
elithrar
elithrar12mo ago
We're going to introduce an env var that takes predecence over wrangler.toml localConnectionString
carlos-alberto
carlos-alberto12mo ago
I opened a PR at https://github.com/cloudflare/cloudflare-go/pull/1492 to add the support for Hyperdrive to cloudflare-go, hope it's okay, first go attempt 😄
GitHub
Add Hyperdrive CRUD support by carlos-alberto · Pull Request #1492 ...
Add support for managing Hyperdrive configs Description Resolves #1491 Mainly wrote by copying the existing queue.go Has your change been tested? Tested ListHyperdriveConfigs manually Added tests ...
Paul
Paul12mo ago
if i'm using hyperdrive to connect to a database that handles my user auth sessions, and i have caching enabled with 60 second max_age, and someone logs out... does that mean that for the next 60 seconds they might be pulling their old cached session? This is tragic for me -- is this still the case?

Did you find this page helpful?