drizzle-team / drizzle-team/drizzle-orm

[DOCS]: Incorrect Usage of drizzle Function with Supabase and Drizzle ORM

Open
#3,709 0 comments 0 reactions 0 assignees View on GitHub
docs docs/incorrect
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Enhancement hasn't been filed before.

- [X] I have verified this enhancement I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

**File:** `src/db/index.ts`

**Problem:**
The following code snippet in the setup is incorrect:

```typescript
export const db = drizzle({ client });
```

This results in the error:
```
Object literal may only specify known properties, and 'client' does not exist in type 'Sql<{}>'.ts(2353)
```

**Cause:**
The `drizzle` function expects the `client` instance to be passed directly, not wrapped in an object.

**Solution:**
Update the code to:

```typescript
export const db = drizzle(client);
```

This resolves the type error and aligns with the expected signature of the `drizzle` function.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.