Skip to content

fix(docs): correct drizzle import in Supabase and Xata get-started#678

Open
emmayusufu wants to merge 1 commit into
drizzle-team:mainfrom
emmayusufu:fix/get-started-postgres-js-import
Open

fix(docs): correct drizzle import in Supabase and Xata get-started#678
emmayusufu wants to merge 1 commit into
drizzle-team:mainfrom
emmayusufu:fix/get-started-postgres-js-import

Conversation

@emmayusufu

Copy link
Copy Markdown

Closes drizzle-team/drizzle-orm#3161.

The first connection example on the Supabase and Xata get-started pages has two problems:

  • It imports drizzle from drizzle-orm, which doesn't export it, so you get Module '"drizzle-orm"' has no exported member 'drizzle'.ts(2305).
  • It calls drizzle('postgres-js', process.env.DATABASE_URL), but the postgres-js driver's drizzle takes a connection string (or client) as the first argument, not a dialect name.

Both pages use the postgres driver, so I changed them to import from drizzle-orm/postgres-js and pass the connection string directly, matching how the node-postgres get-started page already does it:

import { drizzle } from 'drizzle-orm/postgres-js'
const db = drizzle(process.env.DATABASE_URL!);

#3161 only mentions Supabase, but Xata had the identical broken snippet, so I fixed both. The later examples on these pages already use the correct drizzle-orm/postgres-js import, so this just brings the first one in line.

The first connection example on the Supabase and Xata get-started pages
imported drizzle from "drizzle-orm", which doesn't export it (TS2305), and
called drizzle('postgres-js', url), which isn't a valid signature. Both
pages use the postgres-js driver, so import from "drizzle-orm/postgres-js"
and pass the connection string directly, matching the node-postgres
get-started page.

Closes #3161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Module '"drizzle-orm"' has no exported member 'drizzle'.ts(2305)

1 participant