When transaction API used for update => Error: In order to use the .transaction() api, please enable 'experimentalFeatures = "transactionApi" in your schema.
See original GitHub issueTransactionAPI currently does not support update action.
Bug description
The transaction API works well for create. But throws an error when tried with update action
Error: In order to use the .transaction() api, please enable 'experimentalFeatures = "transactionApi" in your schema. at NewPrismaClient.transaction (C:\Program Files\EA_HOME\GraphQL\essential-node\node_modules\@prisma\client\runtime\index.js:1:202012) at C:\Program Files\EA_HOME\GraphQL\essential-node\src\script.js:673:28 at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:93:5)
How to reproduce
Steps to reproduce the behavior:
- schema.prisma
previewFeatures = ["connectOrCreate", "transactionApi", "distinct"] experimentalFeatures = ["transactionApi"]
- Create an array of update tasks to use with transaction API
- Run the transactional update
- Error
In order to use the .transaction() api, please enable 'experimentalFeatures = "transactionApi" in your schema. at NewPrismaClient.transaction (C:\Program Files\EA_HOME\GraphQL\essential-node\node_modules\@prisma\client\runtime\index.js:1:202012) at C:\Program Files\EA_HOME\GraphQL\essential-node\src\script.js:673:28 at runMicrotasks (<anonymous>)
Expected behavior
Prisma information
Environment & setup
- OS: windows
- Database: SQLite
- Node.js version: v14.5.0
- Prisma version:
@prisma/cli : 2.4.1
Current platform : windows Query Engine : query-engine 195d4bdc2d16132977f4ba7a8ca312f7906cb086 (at node_modules\@prisma\cli\query-engine-windows.exe) Migration Engine : migration-engine-cli 195d4bdc2d16132977f4ba7a8ca312f7906cb086 (at node_modules\@prisma\cli\migration-engine-windows.exe) Introspection Engine : introspection-core 195d4bdc2d16132977f4ba7a8ca312f7906cb086 (at node_modules\@prisma\cli\introspection-engine-windows.exe) Format Binary : prisma-fmt 195d4bdc2d16132977f4ba7a8ca312f7906cb086 (at node_modules\@prisma\cli\prisma-fmt-windows.exe) Preview Features : connectOrCreate, transactionApi, distinct
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Maybe the error need to be clearer, something like: a resolved operation was passed to the transaction, please dont do that.
@janpio I am not sure how we can possibly detect a query that user intends to use inside of a transaction without a linter like eslint.