Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Database deployment failure - D1 database not synced between NuxtHub and Cloudflare #649

@Mehdi-Hp

Description

@Mehdi-Hp

Deployment to production fails with a D1 database binding error, despite the database appearing to exist in the NuxtHub admin dashboard. The database exists in NuxtHub but is not properly synced to the Cloudflare dashboard.

I dropped all the tables in NuxtHub, and deleted the database from CF dashboard. Now, when I try to deploy, it runs the migrations and creates the tables, but don't see the database in the cloudflare dashboard.

NuxtHub:
Image
CF:
Image


Error Message on nuxthub deploy --production

  ✔ Found 1 database migration on xxx
  ℹ No pending database migrations to apply.
  ✖ Failed to deploy xxx to production.

  ERROR Failed to publish your Function. Got error: binding DB of type d1 must have a database that already exists. Use wrangler or the UI to create the database.

  ELIFECYCLE Command failed with exit code 1.

Environment

  • NuxtHub Version: 0.9.0 (via @nuxthub/core)
  • Nuxt Version: 4.0.3
  • Node.js Version: 23+
  • Package Manager: pnpm
  • Platform: Cloudflare Pages
  • Wrangler: 4.31.0

Configuration

// nuxt.config.ts:
hub: {
	cache: true,
    database: true,
    kv: true,
    blob: true
}
// drizzle.config.ts:
export default defineConfig({
    dialect: `sqlite`,
    schema: `./server/database/schema.ts`,
    out: `./server/database/migrations`,
    casing: `snake_case`
 });

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions