Skip to content

fix(cli): handle D1 driver in CLI commands#759

Merged
atinux merged 1 commit intonuxt-hub:mainfrom
onmax:fix/cli-d1-driver-error
Jan 13, 2026
Merged

fix(cli): handle D1 driver in CLI commands#759
atinux merged 1 commit intonuxt-hub:mainfrom
onmax:fix/cli-d1-driver-error

Conversation

@onmax
Copy link
Copy Markdown
Contributor

@onmax onmax commented Dec 30, 2025

Fixes #707

Problem

nuxt db migrate crashes with Cannot read properties of undefined (reading 'uri') when using D1 driver.

Solution

Auto-detect NUXT_HUB_CLOUDFLARE_* env vars for D1 CLI commands. If credentials found, use d1-http. If not, show helpful error with wrangler alternative.

Reproduce bug

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-707
cd nuxthub-707 && pnpm i && pnpm prepare && pnpm nuxt db migrate
# ERROR  Cannot read properties of undefined (reading 'uri')

Verify fix

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-707-fixed
cd nuxthub-707-fixed && pnpm i && pnpm nuxt db migrate
# ERROR  D1 CLI commands require Cloudflare API credentials. Set NUXT_HUB_CLOUDFLARE_ACCOUNT_ID...

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 30, 2025

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 30, 2025

npm i https://pkg.pr.new/@nuxthub/core@759

commit: 7d9da71

@onmax onmax force-pushed the fix/cli-d1-driver-error branch from 1b8601b to e7ad644 Compare December 30, 2025 10:54
Auto-detect Cloudflare API credentials from env vars when using D1 driver.
Falls back to helpful error message if credentials not available.
@onmax onmax force-pushed the fix/cli-d1-driver-error branch from e7ad644 to 7d9da71 Compare December 30, 2025 11:04
@atinux atinux merged commit 1a9bab6 into nuxt-hub:main Jan 13, 2026
7 of 9 checks passed
@onmax onmax deleted the fix/cli-d1-driver-error branch January 13, 2026 14:13
@onmax onmax mentioned this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nuxt db migrate fails: Cannot read connection.uri from undefined

2 participants