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.