Skip to content

Commit 70f905e

Browse files
committed
fix: postgres hyperdrive binding example
1 parent 39b352e commit 70f905e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/content/1.docs/3.recipes/5.postgres.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ import type { Hyperdrive } from '@cloudflare/workers-types'
117117
import postgres from 'postgres'
118118

119119
export function usePostgres() {
120-
const hyperdrive = process.env.POSTGRES as Hyperdrive | undefined
120+
// @ts-expect-error globalThis.__env__ is not defined
121+
const hyperdrive = process.env.POSTGRES || globalThis.__env__?.POSTGRES || globalThis.POSTGRES as Hyperdrive | undefined
121122
const dbUrl = hyperdrive?.connectionString || process.env.NUXT_POSTGRES_URL
122123
if (!dbUrl) {
123124
throw createError('Missing `POSTGRES` hyperdrive binding or `NUXT_POSTGRES_URL` env variable')

0 commit comments

Comments
 (0)