Prisma interactive transactions API error: "Argument of type 'x' is not assignable to parameter of type 'PrismaPromise<any>[]'"
See original GitHub issueBug description
See discussion in the prisma chat: https://prisma.slack.com/archives/CA491RJH0/p1628865496360000
A simple update query inside the transaction gives me an error: Argument of type '() => Promise<Integration>' is not assignable to parameter of type 'PrismaPromise<any>[]'
.
const trans = await this.prisma.$transaction(async () => {
return this.prisma.integration.update({
data: {
...
},
where: {
id: integration.id
}
});
});
I do have the preview feature on: previewFeatures = ["orderByRelation", "referentialActions", "interactiveTransactions"]
, also I did a generate.
How to reproduce
Simple query like:
const trans = await this.prisma.$transaction(async () => {
return this.prisma.integration.update({
data: {
...
},
where: {
id: integration.id
}
});
});
### Expected behavior
Not to show me the error
### Prisma information
```js
model Integration {
id String @id @db.VarChar(255)
integrationMethodId String @db.VarChar(255)
name String @db.VarChar(255)
username String @db.VarChar(255)
password String @db.VarChar(255)
descriptionCharacterLimit Int @db.Integer
createdAt DateTime @default(now()) @db.Timestamptz
updatedAt DateTime @updatedAt @db.Timestamptz
@@unique([integrationMethodId, username])
}
Environment & setup
- OS: Windows
- Database: PostgreSQL
- Node.js version: v14.15.5
Prisma Version
2.29.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Prisma transaction in nodejs and typescript not working
Argument of type '(tx: any) => Promise' is not assignable to parameter of type 'PrismaPromise[]'. Type '(tx: any) => Promise' is missing the ......
Read more >Typing for transaction doesn't include async function argument
Argument of type '(prismaClient: any) => Promise<any>' is not assignable to parameter of type 'PrismaPromise<any>[]'. Type '(prismaClient: ...
Read more >prisma is not assignable to type - You.com | The AI Search ...
prisma /prismaPrisma interactive transactions API error: "Argument of type 'x' is not assignable to parameter of type 'PrismaPromise<any>[]'"#8739.
Read more >Argument Type not assignable to Parameter Type Variables
I'm passing an object of arguments into the graphcool api and am getting this: Argument type {tag: string, from: string, to: [string], ...
Read more >hi I am still having some issues with the interactive transa - Linen
Argument of type '() => Promise<Integration[]>' is not assignable to parameter of type 'PrismaPromise<any>[]' const [updatedIntegration] = await this.prisma ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! Yes I did add add the preview feature,
db push
and try a few things but I’m not sure exactly what fixed it as I threw a bunch of solutions at once at the issue. It might just be my vscode being weird. One of those solutions i mentioned sure worked lol!Just to clarify the transaction actually worked, just the ts typings were throwing linting errors
Marking this issue as resolved. Feel free to re-open or ping me if you encounter this again. Please make sure that you have regenerated your Prisma Client after enabling the preview flag and restarted your TS server (or VSCode).