-
-
Notifications
You must be signed in to change notification settings - Fork 746
Incorrect NuxtHub version handling #3679
Copy link
Copy link
Closed
Description
Environment
- Node.js version
v22.14.0 - Package manager
pnpm 10.14.0 - Nuxt version
4.2.2- Nitro version2.12.9- Buildervite 7.3.1 - nuxt/content
v3.10.0 - nuxt/hub
@nuxthub/core 0.10.4
Version
v3.10.0
Reproduction
Deploy Nuxt Content (3.10) with Nuxt Hub (0.10.4) on, say, Vercel (anything else than cloudflare)
Description
There is a logic bug in handling the huxthub version:
content/src/presets/nuxthub.ts
Lines 50 to 58 in 53b3dc8
| const nuxthubVersion = nuxt.options.hub?.database === true ? 0.9 : 0.10 | |
| // NuxtHub <= 0.9 | |
| if (nuxthubVersion <= 0.9) { | |
| if (nitroConfig.runtimeConfig?.content?.database?.type === 'sqlite') { | |
| logger.warn('Deploying with NuxtHub < 1 requires using D1 database, switching to D1 database with binding `DB`.') | |
| nitroConfig.runtimeConfig!.content!.database = { type: 'd1', bindingName: 'DB' } | |
| } | |
| } | |
| else if (nuxthubVersion >= 0.10) { |
For nuxthub 0.10.* (current latest), nuxthubVersion will be assigned a value of 0.10 which is 0.1 (surprise surprise), therefore it falls under a <= 0.9 brach and the correct else if brach is not executed. In the PR, I have replaced this numeric check with a check similar to the one in the setup method
content/src/presets/nuxthub.ts
Lines 19 to 23 in 53b3dc8
| // NuxtHub <= 0.9 | |
| if (nuxtOptions.hub?.database === true) { | |
| options.database ||= { type: 'd1', bindingName: 'DB' } | |
| } | |
| else if (typeof nuxtOptions.hub?.db === 'string' && typeof hubDb === 'object') { |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels