Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Jan 2, 2026

Closes #3667
resolves #3666

Summary

  • sql_dump.txt routes fail prerendering with crawlLinks: true because handlers need cloudflare bindings (ASSETS) unavailable at build time
  • Fix: add prerender.ignore pattern for these routes in cloudflare and node presets

StackBlitz

Link Expected
Bug nuxthub-754 ❌ Build fails
Fix nuxthub-754-fixed ✅ Build succeeds

CLI Reproduction

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-754
cd nuxthub-754 && pnpm i && pnpm build

Verify fix

git sparse-checkout add nuxthub-754-fixed
cd ../nuxthub-754-fixed && pnpm i && pnpm build

The -fixed folder uses pnpm patch to apply the fix locally.

Related

@vercel
Copy link

vercel bot commented Jan 2, 2026

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

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 2, 2026

npm i https://pkg.pr.new/@nuxt/content@3668

commit: bb3627b

@farnabaz
Copy link
Member

farnabaz commented Jan 5, 2026

Disabling pre-render is not the solution for the problem. When database is disabled, NuxtHub Preset does not call parent preset and therefore sql_dump route do not register.

if (!nuxtOptions.hub?.db && !nuxtOptions.hub?.database) {
logger.warn('NuxtHub dedected but the database is not enabled. Using local SQLite as default database instead.')
return
}

Do you mind updating your PR with:

// file: src/presets/nuxthub.ts
    if (nuxtOptions.hub?.db || nuxtOptions.hub?.database) {
    const runtimeConfig = nuxt.options.runtimeConfig as unknown as { hub: { db?: boolean | { driver: string, connection: { url?: string } }, database?: boolean | { driver: string, connection: { url?: string } } } }
    // Read from the final hub database configuration
    const hubDb = runtimeConfig.hub.db || runtimeConfig.hub.database
    // NuxtHub <= 0.9
    if (nuxtOptions.hub?.database === true) {
      options.database ||= { type: 'd1', bindingName: 'DB' }
    }
    else if (typeof nuxtOptions.hub?.db === 'string' && typeof hubDb === 'object') {
      if (hubDb.driver === 'd1') {
        options.database ||= { type: 'd1', bindingName: 'DB' }
      }
      else if (hubDb.driver === 'node-postgres') {
        options.database ||= { type: 'postgresql', url: hubDb.connection.url as string }
      }
      else {
        options.database ||= { type: hubDb.driver as 'sqlite' | 'postgresql' | 'postgres' | 'libsql' | 'pglite', ...hubDb.connection } as unknown as SqliteDatabaseConfig | LibSQLDatabaseConfig | PGliteDatabaseConfig
      }
    }
    } else {
      logger.warn('NuxtHub dedected but the database is not enabled. Using local SQLite as default database instead.')
      return
    }

@farnabaz
Copy link
Member

farnabaz commented Jan 6, 2026

@luminous8 @onmax Do you mind testing with PR release npm i https://pkg.pr.new/@nuxt/content@bb3627b and confirm the fix?

@onmax
Copy link
Contributor Author

onmax commented Jan 6, 2026

Tested with npm i https://pkg.pr.new/@nuxt/content@bb3627b - build succeeds ✅

[nitro] ├─ /__nuxt_content/content/sql_dump.txt (56ms)
└  ✨ Build complete!

Repro: https://github.com/onmax/repros/tree/main/nuxthub-754-fixed

@farnabaz farnabaz changed the title fix: exclude sql_dump.txt routes from prerendering fix(nuxthub): register sql_dump route even if the database is disabled Jan 7, 2026
@farnabaz farnabaz merged commit bb78812 into nuxt:main Jan 7, 2026
4 of 5 checks passed
@onmax onmax deleted the fix/sql-dump-prerender-ignore branch January 7, 2026 11:45
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.

sql_dump.txt routes fail prerender with crawlLinks: true CF workers fail because of sql_dump.txt

2 participants