Problem
When using nitro-cloudflare-dev for local D1 emulation, NuxtHub cannot find bindings during startup.
nitro-cloudflare-dev sets globalThis.__env__ as a Promise initially. NuxtHub accesses globalThis.__env__?.DB synchronously, which returns undefined because the Promise object doesn't have a DB property.
Reproduction
git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-741
cd nuxthub-741 && pnpm i && pnpm dev
Console shows:
🔥 Cloudflare context bindings enabled for dev server
[nuxt:hub] ERROR Failed to create migrations table
DB binding not found
Expected
Migrations run successfully with local D1 emulation.
Problem
When using
nitro-cloudflare-devfor local D1 emulation, NuxtHub cannot find bindings during startup.nitro-cloudflare-devsetsglobalThis.__env__as a Promise initially. NuxtHub accessesglobalThis.__env__?.DBsynchronously, which returns undefined because the Promise object doesn't have aDBproperty.Reproduction
Console shows:
Expected
Migrations run successfully with local D1 emulation.