drizzle-team / drizzle-team/drizzle-orm
[BUG]: AWS Data API - drizzle-kit push fails on NextAuth schema
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.30.10
### What version of `drizzle-kit` are you using?
0.20.17-e38e63d
### Describe the Bug
1. Clone the example connecting Drizzle to AWS RDS from the SST repository, and install dependencies (I used `pnpm`, not sure if this makes a difference):
https://github.com/sst/ion/tree/dev/examples/aws-drizzle
2. Replace `todo.sql.ts` with the following schema (derived from the T3 stack's implementation for NextAuth):
https://pastebin.com/6Qa1bSHk
3. Initialize repository with `sst dev`, and exit when the api is accessible
4. Run `pnpm run db push`, this succeeds
5. Run `pnpm run db push` again, this now throws the exception
`DatabaseErrorException: ERROR: bind message supplies 0 parameters, but prepared statement "sqlx_s_18" requires 2; SQLState: 08P01`
The full logs from RDS are as follows:
```
2024-05-24 18:11:43 UTC:[local]:postgres@grapl_web:[2735]:ERROR: bind message supplies 0 parameters, but prepared statement "sqlx_s_3" requires 2
2024-05-24 18:11:43 UTC:[local]:postgres@grapl_web:[2735]:STATEMENT: SELECT conname AS primary_key
FROM pg_constraint join pg_class on (pg_class.oid = conrelid)
WHERE contype = 'p'
AND connamespace = $1::regnamespace
AND pg_class.relname = $2;
----------------------- END OF LOG ----------------------
```
A similar error is thrown when running the `introspect` command as well, so I suspect this is an issue with how `drizzle-kit` implements the AWS Data API driver.
### Expected behavior
The second `pnpm run db push` should output `[i] No changes detected`, like it does for the original `todo.sql.ts`.
### Environment & setup
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.