-
Notifications
You must be signed in to change notification settings - Fork 108
POSTGRES binding not found with DATABASE_URL #777
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Cannot use postgre in local with DATABASE_URL variable in .env, im getting a "Binding not found" issue, while when i use "POSTGRES" instead of DATABASE_URL, it works
Im getting this error
✔ Nuxt Nitro server built in 1448ms nitro 2:14:37 PM
ℹ Vite server warmed up in 0ms 2:14:37 PM
ℹ Vite client warmed up in 1ms 2:14:37 PM
[nuxt:hub] ERROR Failed to create migrations table 2:14:38 PM
POSTGRES binding not found
ERROR [request error] [unhandled] [GET] http://localhost:3066/api/_auth/session 2:14:44 PM
ℹ Error: POSTGRES binding not found
⁃ at getDb (.nuxt/hub/db.mjs:8:28)
3 ┃
4 ┃ let _db
5 ┃ function getDb() {
6 ┃ if (!_db) {
7 ┃ const hyperdrive = process.env.POSTGRES || globalThis.__env__?.POSTGRES || globalThis.POSTGRES
❯ 8 ┃ if (!hyperdrive) throw new Error('POSTGRES binding not found')
9 ┃ _db = drizzle({ connection: hyperdrive.connectionString, schema })
10 ┃ }
11 ┃ return _db
12 ┃ }
13 ┃ const db = new Proxy({}, { get(_, prop) { return getDb()[prop] } })
⁃ at Object.get (.nuxt/hub/db.mjs:13:50)
⁃ (server/plugins/session.ts:15:0)
⁃ (node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:57)
⁃ (node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:47)
⁃ at parallelTaskCaller (node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:28)
⁃ at Hookable.callHookWith (node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:198:20)
⁃ at Hookable.callHookParallel (node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:191:17)
⁃ at Object.handler (node_modules/.pnpm/nuxt-auth-utils@0.5.26_magicast@0.5.1/node_modules/nuxt-auth-utils/dist/runtime/server/api/session.get.js:6:23)
[CAUSE]
Error {
stack: 'POSTGRES binding not found\n' +
'at getDb (./.nuxt/hub/db.mjs:8:28)\n' +
'at Object.get (./.nuxt/hub/db.mjs:13:50)\n' +
'at ./server/plugins/session.ts:15:0)\n' +
'at ./node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:57)\n' +
'at ./node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:47)\n' +
'at parallelTaskCaller (./node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:55:28)\n' +
'at Hookable.callHookWith (./node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:198:20)\n' +
'at Hookable.callHookParallel (./node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs:191:17)\n' +
'at Object.handler (./n'... 129 more characters,
message: 'POSTGRES binding not found',
}
ERROR [request error] [unhandled] [GET] http://localhost:3066/api/_auth/session 2:14:44 PM
.env
DATABASE_URL="postgresql://XXXX@127.0.0.1/mydb"
nuxt config
hub: {
db: 'postgresql',
blob: true
},
my project info
- Operating System: `Darwin`
- Node Version: `v22.14.0`
- Nuxt Version: `4.2.1`
- CLI Version: `3.30.0`
- Nitro Version: `2.12.9`
- Package Manager: `pnpm@9.15.0`
- Builder: `-`
- User Config: `modules`, `devtools`, `css`, `runtimeConfig`, `compatibilityDate`, `i18n`, `hub`, `nitro`, `vite`
- Runtime Modules: `@nuxt/ui@4.2.1`, `@nuxthub/core@0.10.4`, `nuxt-auth-utils@0.5.26`, `@polar-sh/nuxt@0.5.3`, `@nuxtjs/i18n@9.5.6`
- Build Modules: `-`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working