-
-
Notifications
You must be signed in to change notification settings - Fork 744
fix(nuxthub): register sql_dump route even if the database is disabled #3668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@onmax is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
|
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. content/src/presets/nuxthub.ts Lines 15 to 18 in 7c07081
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
}
|
|
@luminous8 @onmax Do you mind testing with PR release |
|
Tested with Repro: https://github.com/onmax/repros/tree/main/nuxthub-754-fixed |
Closes #3667
resolves #3666
Summary
sql_dump.txtroutes fail prerendering withcrawlLinks: truebecause handlers need cloudflare bindings (ASSETS) unavailable at build timeprerender.ignorepattern for these routes in cloudflare and node presetsStackBlitz
CLI Reproduction
Verify fix
The
-fixedfolder uses pnpm patch to apply the fix locally.Related
sql_dump.txtfrom Nuxt Content nuxt-hub/core#754