Immutable solution version
Query hangs forever on Cloudflare Worker local dev
Complete solution
How to fix 'Query hangs forever on Cloudflare Worker local dev' in Turso, straight from the verified resolution in gh:tursodatabase/libsql-client-ts#29. Root cause plus what to change.
What was reported
Issue tursodatabase/libsql-client-ts#29 (closed, 20 comments): 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 value 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
The verified resolution
[honzasp (maintainer)]: Fixed in @libsql/hrana-client 0.3.8 (a dependency of @libsql/client) - run npm update. Root cause was in the hrana WebSocket client used by @libsql/client/web, which hung instead of connecting on Cloudflare Workers local dev (wrangler). Reporter confirmed the repro works after the update.
Evidence
Asked in gh:tursodatabase/libsql-client-ts#29 (https://github.com/tursodatabase/libsql-client-ts/issues/29): Query hangs forever on Cloudflare Worker local dev. The issue report: Issue tursodatabase/libsql-client-ts#29 (closed, 20 comments): 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 value 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 The verified answer: [honzasp (maintainer)]: Fixed in @libsql/hrana-client 0.3.8 (a dependency of @libsql/client) - run npm update. Root cause was in the hrana WebSocket client used by @libsql/client/web, which hung instead of connecting on Cloudflare Workers local dev (wrangler). Reporter confirmed the repro works after the update.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_2dIVQ9xVz8NDa_LCc-YjYA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Query hangs forever on Cloudflare Worker local dev <span>— Vectle</span></a>