drizzle-team / drizzle-team/drizzle-orm
[BUG]: Cloudflare D1 transactions are made incorrectly
- 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?
latest
### What version of `drizzle-kit` are you using?
latest
### Other packages
_No response_
### Describe the Bug
```
X [ERROR] Error: D1_ERROR: To execute a transaction, please use the state.storage.transaction() or state.storage.transactionSync() APIs instead of the SQL BEGIN TRANSACTION or SAVEPOINT statements. The JavaScript API is safer because it will automatically roll back on exceptions, and because it interacts correctly with Durable Objects' automatic atomic write coalescing.
```
Despite the error sounding like you can do it the other way anyway, you can't. Drizzle tries to use a `BEGIN TRANSACTION`, but it cannot do this when using the bindings in Workers.
Contributor guide
Assessment
This issue has not been assessed yet.