Skip to content

Support force node:sqlite instead of bun:sqlite when enabling native DB connector in Bun #3758

@typed-sigterm

Description

@typed-sigterm

Environment

Operating system Windows 10.0.26200
CPU Intel(R) Core(TM) Ultra 5 225H (14 cores)
Node.js version v24.9.0
nuxt/cli version 3.34.0
Package manager bun@1.3.11
Nuxt version 4.4.2
Nitro version 2.13.3
Builder rolldown-vite@7.3.1
Config appConfig, app, compatibilityDate, content, css, devServer, devtools, fonts, hooks, icon, llms, modules, ogImage, site, sitemap, vite
Modules @nuxt/ui@4.6.1, @nuxt/content@3.12.0, @nuxtjs/seo@5.1.0, @vueuse/nuxt@14.2.1, nuxt-llms@0.2.0

Version

v3.12.0

Reproduction

https://codesandbox.io/p/devbox/tender-pascal-dyzh65

Description

I'm using Bun locally, and deploy to Cloudflare Workers. When enabling content.experimental.sqliteConnector = 'native' with bun run build, it automatically uses bun:sqlite even though node:sqlite is also supported in Bun, but Cloudflare can't recognize bun:sqlite, so it fails:

[nitro 4:59:23 AM] ℹ Building Nuxt Nitro server (preset: cloudflare-module, compatibility date: 2026-04-05)

[nitro 4:59:30 AM]  ERROR  Error: Cannot resolve "bun:sqlite" from "/project/workspace/node_modules/.pnpm/db0@0.3.4/node_modules/db0/dist/connectors/bun-sqlite.mjs" and externals are not allowed!


undefined

2027 |           if (_resolved) {
2028 |             return { id: _resolved, external: false };
2029 |           }
2030 |         }
2031 |         if (!resolved || resolved.external && !id.endsWith(".wasm")) {
2032 |           throw new Error(
                           ^
error: Cannot resolve "bun:sqlite" from "/project/workspace/node_modules/.pnpm/db0@0.3.4/node_modules/db0/dist/connectors/bun-sqlite.mjs" and externals are not allowed!
     plugin: "commonjs--resolver",
       hook: "resolveId",
 watchFiles: [...],
       code: "PLUGIN_ERROR"

      at resolveId (/project/workspace/node_modules/nitropack/dist/rollup/index.mjs:2032:21)

Maybe there the sqliteConnector can be ... | 'native-node' | 'native-bun' to support explicitly avoid the problem.

Note: Add run.bun = true to bunfig.toml to make sure node xxx child-processes are routed to Bun

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions