libsql
libsql copied to clipboard
Cloudflare Worker issue
Hi, how is it possible to use turso from a worker?
You have the "cloudflare" flag for it.
But the only methods to create a remote connection, that I believe its what I have to use, force me to enable the remote flag, once I do, I always end up with the mio dependency activated.
And AFAIK there is no way to compile mio to wasm just yet.
Is there some other way to establish a connection, some alternative method?
I have found this ts example... https://github.com/tursodatabase/examples/blob/master/app-workers-turso-ts-demo/src/index.ts
Thank you!
I've been using with no problem for long time. It is important that you use client for the edge runtime as shown here: https://docs.turso.tech/sdk/ts/quickstart
import { createClient } from "@libsql/client/web";
export const turso = createClient({
url: process.env.TURSO_DATABASE_URL,
authToken: process.env.TURSO_AUTH_TOKEN,
});
@flexchar My point was using it from rust, but I was able to use it using the deprecated libsql-client-rs https://github.com/tursodatabase/libsql-client-rs?tab=readme-ov-file#cloudflare-workers
I even ported the axum example to use it https://github.com/spigaz/workers-rs-axum-tursodb
Yes, the libsql-client-rs API is a bit old.
I tried to integrate, but mentioned issue still exists. Looks like this is still an issue to use Turso from CloudFlare Rust. Any eta on this Bug? Formally feature exists, but it doesn't work/compile