libsql-client-ts: Query hangs forever on Cloudflare Worker local dev
Discord thread: https://discord.com/channels/933071162680958986/1100593117075345449/1100593117075345449
Running this code on Cloudflare Workers local dev hangs forever
import { createClient } from "@libsql/client/web";
await createClient({
  url: context.TURSO_DATABASE_URL,
  authToken: context.TURSO_AUTH_TOKEN,
}).execute(`select * from users`);
Debugging shows its stuck on this line but can’t debug further because it just hangs, doesn’t throw an error https://github.com/libsql/libsql-client-ts/blob/358767835750c69df3073d0f43bb7f9e2d8cc34f/src/hrana.ts#L64
Work around for now is to use import { createClient } from "@libsql/client/http"; instead of import { createClient } from "@libsql/client/web";
Thank you!
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 20 (9 by maintainers)
I just released version 0.3.8 of
@libsql/hrana-client(which is a dependency of@libsql/client). Could you please try updating your dependencies usingnpm updateand checking whether the issue is resolved? The reproducing example now works for me.Hi Ben, thank you for your report! I released a new version 0.3.11 of
@libsql/hrana-client(which is a dependency of this package), which should fix your issue on Cloudflare Workers. Can you please give it a try? We seem to have hit yet another problem with the Cloudflare implementation of WebSockets 😕There are no immediate plans to remove WebSockets from the client, because the HTTP API does not support transactions. But if you don’t use transactions, then HTTP should work just fine for you.
Talking to the team I think the Websocket part is getting removed. Use http for now
Here is a reproduction https://github.com/arjunyel/turso-remix-bug
npm installRename
.dev.vars.exampleto.dev.varsand fill out with Turso variablesModify the query in
app/routes/_index.tsxnpm run devTry to navigate to http://127.0.0.1:8788/, it hangs forever