Skip to content

[BUG]: Transaction Rollback throws TransactionRollbackError #1447

@iabdulhannan

Description

@iabdulhannan

What version of drizzle-orm are you using?

0.27.2

What version of drizzle-kit are you using?

0.19.13

Describe the Bug

await conn.transaction(async (tx) => { try { some query fails and throws an Exception } catch (e) { tx.rollback() } })

Output:
TransactionRollbackError [DrizzleError]: Rollback
at PostgresJsTransaction.rollback (webpack-internal:///(rsc)/./node_modules/drizzle-orm/session-2062e9e6.mjs:432:15)
at eval (webpack-internal:///(rsc)/./src/app/api/projectManager/initializeProject/route.ts:53:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async scope (webpack-internal:///(rsc)/./node_modules/postgres/src/index.js:208:26)
at async Function.begin (webpack-internal:///(rsc)/./node_modules/postgres/src/index.js:198:20)
at async POST (webpack-internal:///(rsc)/./src/app/api/projectManager/initializeProject/route.ts:30:21)
at async /Users/abdulhannan/Work/Personal/FUI/cdre/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:61466

Expected behavior

Transaction must be rolled back

Environment & setup

"next": "latest",
"drizzle-orm": "^0.27.2",
"drizzle-kit": "^0.19.13",
"postgres": "^3.3.5",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions