Closed penberg closed 1 year ago
Huh, and if they change the protocol to ws:
, it works? That's super weird, because the code explicitly handles libsql:
URLs:
https://github.com/libsql/libsql-node-sqlite3/blob/main/src/database.ts#L268
Maybe they need to use libsqls:
or wss:
? If the database is on Turso, it needs TLS, and the 301 response looks like the server is trying to redirect from http to https.
I asked them to use https
, which works.
Yes, https
is internally rewritten to wss
. I'm still not sure whether silently rewriting HTTP schemes to WebSockets isn't a mistake, though!
@honzasp I was thinking that using http or https in the URL is what allows someone to opt into the stateless HTTP implementation with any SDK, if that's what they want or need. Otherwise, it seems impossible without some other configuration in place.
For this library, maybe it would explicitly reject http-based URLs if the assumption is that websockets are always required to make good on compatibility with sqlite3.
This issue was caused because libsql:
used to mean ws:
, but now it means wss:
. I therefore consider it fixed :)
Also, the new major version will explicitly reject "http" and "https" URLs, suggesting to replace them with "ws" and "wss". This is done to be less confusing and compatible with @libsql/client
.
Currently, if you use the
libsql:
protocol, you get the following error:Reported by Dan Kochetov from Drizzle team.