drizzle-team / drizzle-team/drizzle-orm
[BUG]: Cloudflare D1 transaction not supported
- 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.31.1
### What version of `drizzle-kit` are you using?
0.22.2
### Describe the Bug
When trying to execute a transacction with cloudflare d1 adapter it throws the following error:
> To execute a transaction, please use the state.storage.transaction() API 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.
To reproduce create a project using [c3](https://developers.cloudflare.com/pages/get-started/c3/)
```js
import { drizzle } from 'drizzle-orm/d1';
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise {
const db = drizzle(env.DB);
await db.transaction(async (tx) => {
// Throws error
});
return new Response('OK');
}
};
```
### Expected behavior
_No response_
### Environment & setup
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.