N
Neon2y ago
wise-white

Nested Transactions Thread

Oh, you mentioned a ws library, so I guess you will be using the websocket-based one
5 Replies
multiple-amethyst
multiple-amethyst2y ago
I believe I'm using the ws client for transactions and http otherwise. Here's my package.json:
"dependencies": {
"@neondatabase/serverless": "^0.9.1",
"drizzle-orm": "^0.30.9",
"ws": "^8.16.0"
},
"devDependencies": {
"@types/ws": "^8.5.10",
"vitest": "1.4.0"
},
"optionalDependencies": {
"bufferutil": "^4.0.8"
}
"dependencies": {
"@neondatabase/serverless": "^0.9.1",
"drizzle-orm": "^0.30.9",
"ws": "^8.16.0"
},
"devDependencies": {
"@types/ws": "^8.5.10",
"vitest": "1.4.0"
},
"optionalDependencies": {
"bufferutil": "^4.0.8"
}
I've done a bit more testing. The nested transactions work fine on other branches in by dev project. I have production in its own project, and that project is the one that's having the issue I described. I've opened a support ticket and am looking into things on my end. I shared here in case others have run into it. I'm creating this particular transaction with the Pool concept, which I believe uses websockets:
return drizzlePool(new Pool(cfg))
return drizzlePool(new Pool(cfg))
other-emerald
other-emerald2y ago
Yes Pool should be using websockets. I've not come across a project using multi-mode serverless driver before, interesting to see I'm designing a new alternative for transactions with the http driver soon, but it's using the currently unstable Webtransport designs (https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3/)
multiple-amethyst
multiple-amethyst2y ago
Could be misuse on my end. I thought I had read that HTTP was preferred for non-interactive queries and WS was needed for transactions. Happy to adjust by integration if that helps.
other-emerald
other-emerald2y ago
No it is correct for now. Our HTTP driver only supports non-interactive transactions, it does not have the full transaction functionality yet Do keep us updated on the support ticket outcome. Even if it's a misconfiguration it would be good to know 🙂
multiple-amethyst
multiple-amethyst2y ago
Will do. I'm hoping it's something dumb on my end, like caching in the build pipeline somewhere. Since it works in my other project, the most it could be on the Neon side (I think) is a difference in minor version or something. Thanks for sharing the information above. I did a full redeploy of the code and the infrastructure and am still seeing a difference between the two projects. I'll be interested to see if there are any differences between the two projects.

Did you find this page helpful?