DB sometimes returns rows, sometimes returns nothing

I wanted to raise this formally although I've been discussing it in #hyperdrive-beta , as I'm not sure where in the CF stack the issue lies. Basically a single query in my app, among hundreds, sometimes returns rows and sometimes returns this:
{
command: null,
rowCount: null,
oid: null,
rows: Array(0),
fields: Array(0)
...
}
{
command: null,
rowCount: null,
oid: null,
rows: Array(0),
fields: Array(0)
...
}
All other queries work fine, as I say. So I'm sat here refreshing and endpoint and sometimes seeing data and sometimes not (with no code changes). This is happening while running my app locally (with --remote) so HD is being used. So I assume this is a HD issue, though perhaps it's at a Workers/Wrangler level for all I know. I could disable HD caching, but then that presumably defeats the point of HD? Any help is greatly appreciated as this is blocking me at the mo! Thanks in advance.
4 Replies
Mitya
MityaOP12mo ago
This turned out to be an apparently already-known bug with Hyperdrive. The fix for now is to disable caching. Supposedly a longterm fix is coming out later this week.
ernestoresende
ernestoresende12mo ago
Mind sharing where you've found information about the bug in question? I recently stumbled upon the same problem in some internal tooling I made reliant on Hyperdrive to stabilize connection pooling, and it took me a good while to figure out it was happening due to the caching being enabled.
I could disable HD caching, but then that presumably defeats the point of HD?
I think it depends on your workload, in my case it made sense to disable the caching since it was accessing some frequently changing data, and I only wanted Hyperdrive to act as a connection pooler to reduce the number of connections from Workers instances to my origin database
Mitya
MityaOP12mo ago
Check out the conversation in #hyperdrive-beta from around this message downwards. CF have acknowledged there's a bug causing this, though I believe i saw a message in that channel saying they'd now pushed a fix, so I may try to re-enable caching and see if it recorrurs (right now I continue to have caching disabled).
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Mitya
MityaOP12mo ago
Someone in that thread reckoned it affected only parameterised queries, though I'm not sure about that; the vast majority of my queries are parameterised, and it was only one query that was presenting the issue.
Want results from more Discord servers?
Add your server