Describe the bug
Prisma Client 1.17 create mutation generates 2 records
To Reproduce
Steps to reproduce the behavior:
createDraft mutationdrafts queryVersions:
OS X High Sierra prisma CLI: prisma/1.17.0-beta.11 (darwin-x64) node-v8.11.3I can reproduce this.
For anyone trying to reproduce this locally, you will need to follow slightly different instructions and create a user before running createDraft.
Interestingly enough, I cannot reproduce this anymore after some while, without changing anything.
If I then deploy a new service, I cannot reproduce it at all in the new service.
This seems like a very subtle bug or even a problem with the environment setup. To start looking into this, we require a consistent and reliable reproduction, so let us know if you found one.
I got this same issue and seems so hopefully its consistently reproducible with my repo.
To Reproduce
Versions:
Thanks @addstar34, I can once again confirm your reproduction. Looking into this.
@marktani I think I found out what the problem is here, the resolvers need to use async/await with the call to prisma. Eg:
async function createTodo(_parent, args, context, _info) {
return await context.prisma.createTodo({
title: args.title,
description: args.description,
})
}
I think the issue stems from the docs as I just copy pasted the resolvers from here as my starting point which don't use async/await: https://www.prisma.io/docs/1.17/get-started/03-build-graphql-servers-with-prisma-e001/#implement-resolver-functions
@addstar34 : You should be able to do the following as well, if this executes twice, then that is a bug. We will look into it. Thanks!
function createTodo(_parent, args, context, _info) {
return context.prisma.createTodo({
title: args.title,
description: args.description,
})
}
Closing this in favor of #3210, which seems to be a bug in Prisma core.
I've created Mysql DB including Trigger to insert into "audit" table. But every time I insert(Mutation) a record into primary table on the "audit" table insert or duplicate the record. I'd appreciate if this is the same Prisma Core bug you've been talking about.