Wrangler is throwing "connection terminated unexpectedly" errors for my Postgres DB
I have an ongoing issue with Wrangler being weird about connecting to DBs from my machine. Today I've started getting
Error: Connection terminated unexpectedly
from Postgres.
This only happens when using the DB within Wrangler. I have another, non-Wrangler app that connects to the same DB in the same way and via the same connection string, and it's fine. The DB is up, and showing no signs of issues.
Here's the util my controllers call to connect to and run a query on my DB:
The DB connection string is in my TOML under [[Hyperdrive]]
.
If I console.log(client)
right after connecting, it shows readyForQuery: true
. But when I then run a query, I get this error.
Sorry if this is not related to Wrangler but as I say, it's not happening in non-Wrangler setups with the same DB connection code.
Any idea what might be up?2 Replies
Hey @Mitya, did you manage to find a solution for this, and where is your database hosted?
It seems from chatting in #hyperdrive-beta that it was related to an acknowledged bug with HD regarding query caching. The solution for the time being was to disable caching. CF apparently pushed a fix for this a few days ago but I've not disabled caching to verify that. My DB is hosted on Heroku but in light of the above that seems to be irrelevant.