drizzle-orm/libsql 'file:' does not work with Next.js
I'm following https://orm.drizzle.team/docs/get-started-sqlite, but using e.g.
drizzle('file:libsql.db')
does not work with Next.js.
When using import { drizzle } from 'drizzle-orm/libsql'
, I get LibsqlError: URL_SCHEME_NOT_SUPPORTED: The client that uses Web standard APIs supports only "libsql:", "wss:", "ws:", "https:" and "http:" URLs, got "file:". For more information, please read https://github.com/libsql/libsql-client-ts#supported-urls
.
When using import { drizzle } from 'drizzle-orm/libsql/node'
, I get Error: Neon: unsupported system: undefined
.
Both work fine when running a file via e.g. tsx
but not when running with next dev --turbopack
.1 Reply
The example using
better-sqlite3
also doesn't work since it does not find any tables (although they exist).
Ok, the issue was that I still had 'file:' in the URL which is fine for libsql but not for better-sqlite3.
Now it fails with 'Error: The edge runtime does not support Node.js 'path' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime' since I wanted to use the local sqlite db for https://authjs.dev...