-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Describe the bug
When deploying a NuxtHub project to Cloudflare (Workers/Pages), it is not possible to use Turso/libsql as the production database, even when explicitly setting driver: 'libsql' and providing the correct TURSO_DATABASE_URL and TURSO_AUTH_TOKEN environment variables at build time. The deployment logic always overwrites the driver with 'd1' when hub.hosting includes 'cloudflare', making it impossible to use Turso in Cloudflare production environments.
Even though it should be correctly configured, I always see an error with:
[nuxt-hub] DB binding not found
in the logs during deployment or runtime.
Steps to reproduce
- Set up a NuxtHub project with the following config:
hub: { db: { dialect: 'sqlite', driver: 'libsql', connection: { url: process.env.TURSO_DATABASE_URL, authToken: process.env.TURSO_AUTH_TOKEN } } }
- Add Cloudflare
presetor allow automatic hosting detection - Set
TURSO_DATABASE_URLandTURSO_AUTH_TOKENas build environment variables in Cloudflare dashboard - Deploy project to Cloudflare Workers/Pages
- Observe that NuxtHub always sets the driver to
'd1', ignoring the explicit Turso/libsql config - Log output shows
[nuxt-hub] DB binding not founderror, even when all variables are set.
Expected behavior
Turso/libsql should be used as the production database if configured and environment variables are set. The current behavior forces Cloudflare D1 for all Cloudflare deployments, making it impossible to use Turso as the primary DB provider on CF.