question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property 'transaction' does not exist on type 'PrismaClient<PrismaClientOptions, never>'

See original GitHub issue

Bug description

I followed the docs and added previewFeatures = ["transactionApi"] to the generator client block of the schema.prisma file. However I still receive this typescript compiler error that transaction does not exist.

When I try to execute prisma.transaction(...), I get a runtime error:

UnhandledPromiseRejectionWarning: Error: In order to use the .transaction() api, please enable 'experimentalFeatures = "transactionApi" in your schema.

This error seems to contradict what the docs say. So tried to add experimentalFeatures = "transactionApi" to the generator block instead but still have the same error.

How to reproduce

Add this to schema.prisma

generator client {
  provider             = "prisma-client-js"
  previewFeatures = ["transactionApi"]
  binaryTargets        = ["native"]
}

Run npm prisma generate

Observe error when using prisma.transcation

Expected behavior

Expected to not get an error.

Prisma information

prisma/cli@^2.1.1 prisma/client@^2.1.0

Environment & setup

  • OS: Mac OS with Docker (Alpine Linux)
  • Database: PostgreSQL
  • Node.js version: v12.18.2
  • Prisma version:
@prisma/cli          : 2.2.1
Current platform     : darwin
Query Engine         : query-engine 832e37683666c748b0a1cbdc2c5068b5e443e816 (at /Users/kevin/MediaHound/client/partners/node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 832e37683666c748b0a1cbdc2c5068b5e443e816 (at /Users/kevin/MediaHound/client/partners/node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 832e37683666c748b0a1cbdc2c5068b5e443e816 (at /Users/kevin/MediaHound/client/partners/node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 832e37683666c748b0a1cbdc2c5068b5e443e816 (at /Users/kevin/MediaHound/client/partners/node_modules/@prisma/cli/prisma-fmt-darwin)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
janpiocommented, Jul 23, 2020

The renaming to experimentalFeatures happened in 2.3.0 which was release last Tuesday. You should upgrade your CLI and Client to that version, then it should work. (Alternatively you can use experimentalFeatures = ["transactionApi"] in your schema file with the current version)

0reactions
kaedubcommented, Jul 25, 2020

@pantharshit00 restarting the TS language server fixed it. I appreciate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Property does not exist" when I want to use model added in ...
ts:27:26 Type error: Property 'support' does not exist on type 'PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined>'.
Read more >
Property 'model' does not exist on type 'ObjectDefinitionBlock ...
I know this is not a new issue, but even after reading through related issues and ... does not exist on type 'PrismaClient<PrismaClientOptions,...
Read more >
Prisma Client API (Reference)
The Prisma Client API reference documentation is based on the following schema: ... If the record does not exist, then Prisma creates that...
Read more >
[workaround] Help! Property '[table]' does not exist on type ...
Property '[table]' does not exist on type 'PrismaClient<{ log: LogDefinition[]; }, never, ... I've run: yarn rw generate types – no errors.
Read more >
Prisma | NestJS - A progressive Node.js framework
There also are ready-to-run examples for REST and GraphQL in the ... Prisma Client is a type-safe database client that's generated from your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found