Drizzle + PG + Hyperdrive + Cloudflare Workers doesn't work
I've spent all the day to solve issues. At the end I left!
I built a custom plugin and I ended up that cf close my db connection and the plugin doesn't work 😦
Switching back to vercel
16 Replies
what is the issue?
The db close the connection
I used pg and hyperdrive then I tried neon serverless... same issue
are using the kysley adapter?
Drizzle
could you try connecting using the built (kysley) adapter instead?
this is a migration from vercel to cf. The app use drizzle as adapter
Custom Plugin
Db
Config
the app can use drizzle. this is jsut to allow better auth to connect it to the db
I can try...
at the end I don't need to modify neither
yeah you just need to change the adapter and everything should be the same
Failed to initialize database adapter
wait so you need to wrap auth with something like
getAuth
higher function. Because cf requires request context for db connectionis there any example?
Could you get Better Auth working with a Hyperdrive connection?
Been struggling with it for a while, and gave up. I'm using Postgres, and using the postgres connection string rather than the hyperdrive connection string ended up working for me, but it's not ideal.
I still get issues
@bekacru I published a minimum reproducible
https://nuxt-better-auth-cf.bitsong.workers.dev/
REPO: https://github.com/angelorc/nuxt-better-auth-cf
1. If you try to login with Github, you will get an error
The error is
The script will never generate a response.
2. If you try to refresh, then you can see your sessionGitHub
GitHub - angelorc/nuxt-better-auth-cf
Contribute to angelorc/nuxt-better-auth-cf development by creating an account on GitHub.
Update:
it works fine with
D1
and neon-http
branch-d1: https://github.com/angelorc/nuxt-better-auth-cf/tree/d1
branch-neon-http: https://github.com/angelorc/nuxt-better-auth-cf/tree/neon-http