syntax atomic transaction d1 not working

getting

[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.


when using

return await this.db.transaction(async (tx) => {
const encryptedEmail = await encrypt(email, this.env);

const existingUser = await tx.select().from(users).where(eq(users.email, encryptedEmail)).get();


how to do atomic transaction while keeping drizzle orm syntax using d1 ?
Was this page helpful?