Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Deno SQLite adapter #1188

Closed
jdnavarro opened this issue Oct 6, 2023 · 4 comments
Closed

[Feature Request]: Deno SQLite adapter #1188

jdnavarro opened this issue Oct 6, 2023 · 4 comments
Labels
feature request New feature requests

Comments

@jdnavarro
Copy link

Description

Currently better-sqlite3 doesn't work in Deno. It shouldn't be too hard to write an adapter for the native Deno SQLite3 module.

I can send a PR if it's something you are willing to upstream.

@jdnavarro jdnavarro added the feature request New feature requests label Oct 6, 2023
@pilcrowonpaper
Copy link
Member

I wonder if you can even install @lucia-auth/adapter-sqlite in Deno (resolving dependencies etc)?

@jdnavarro
Copy link
Author

Quickly checking with the Deno REPL, it's possible to get an Auth instance with an undefined db:

> import { lucia } from "npm:lucia";
undefined
> import { betterSqlite3 } from "npm:@lucia-auth/adapter-sqlite";
undefined
> lucia({ adapter: betterSqlite3(undefined, {user: "user", key: "user_key", session: "user_session" }) });
Auth {
  adapter: {
    getUser: [AsyncFunction: getUser],
    setUser: [AsyncFunction: setUser],
...

I could try with a dummy sqlite adapter before trying to implement the actual Sqlite3 Deno adapter. Is there any other adapter I could check first?

I tried with a real libSQL db, but it doesn't support local SQLite files in non node environments.

@pilcrowonpaper
Copy link
Member

Hm, I wonder what's the best way to handle this. Exporting a package that only works in Deno from @lucia-auth/adapter-sqlite etc seems wrong. I know Deno provides drivers for MySQL and PostgreSQL as well, and it might be better to do something like @lucia-auth/adapter-deno. That said, I'm not sure if there's enough interest to make it an official adapter.

@jdnavarro
Copy link
Author

I'm not sure if there's enough interest to make it an official adapter.

Makes sense.

I was exploring the possibility of using Deno as a SvelteKit adapter in order to distribute a single executable. There is already experimental support in node.js for single executable applications, but in our particular case, it gets tricky because we have several FFI bindings.

Aside of the compatibility with lucia and better-sqlite3, there are other factors to consider, so we may abandon the idea.

If we end up going ahead, I can publish an experimental deno lucia adapter as a separate deno module in https://deno.land/x.

@jdnavarro jdnavarro closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature requests
Projects
None yet
Development

No branches or pull requests

2 participants