drizzle-team / drizzle-team/drizzle-orm

[BUG]: AWS RDS Data API throws error on `db.$count`

Open
#4,213 0 comments 3 reactions 0 assignees View on GitHub
bug driver/aws-data-api priority qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.39.3

### What version of `drizzle-kit` are you using?

0.30.4

### Other packages

_No response_

### Describe the Bug

Calling `db.$count(...)` with a `drizzle` client from `drizzle-orm/aws-data-api/pg` and the `RDSClient` from `RDSDataClient` results in the following error:
```
TypeError: Cannot read properties of undefined (reading 'count')
at _AwsDataApiSession.count (/var/task/index.js:327929:13)
```

Replacing it with `db.select({ count: count() }).from(...)` works totally fine. I assume the [`AwsDataApiSession` class](https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/aws-data-api/pg/session.ts#L153) just needs its own implementation of `count()`.

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.