How to solve this GraphQL mutation error with Prisma ORM & NestJS
I am creating a graphql api using nestjs, prisma. When using the graphql playground to create a user I am getting an error as you can seen in the screenshot below. A row is created only with the id other fields of the user model are not transfered. Please have a look and any guidance would be appreciated. It's been a week I am trying to fix this to no avail.










11 Replies
user fields are returned null even though they are passed as variables for the create-input dto

Hi @theblessed
Can you please send the relevant part of the schema and query as text instead of images?
sure
Don't forget to add formatting to the code blocks for legibility.
you mean the mutation query in the playground as well?
This is fine for now. i'm taking a look
Can you double-check the mapping of the incoming
createUserInput to the Prisma UserCreateInput in your NestJS UsersService. Ensure that all fields from the CreateUserInput are correctly mapped to their corresponding fields in the UserCreateInput. Also you may want to share the repository link so i can run it locally and help debug thisit's the id,createdAt and updatedAt fields that are not included in the
createUserInput class as they're generated by prisma automaticallyhere is the repo, thanks for checking for me, I really appreciate. https://github.com/dreamsachiever90/afhv_backend
GitHub
GitHub - dreamsachiever90/afhv_backend
Contribute to dreamsachiever90/afhv_backend development by creating an account on GitHub.
@RaphaelEtim Hi hope you're fine. Please, did you get some time to take a look at the repo?
Hi @theblessed, i took a look at it today. I can see that your data is not propagating to the Prisma service
The log of
createUserInput is an empty object {}Hi thanks for looking. But how can i fix this issue ? Is there something I did wrong? I followed nest js docs with prisma and everything looks fine to me. Any guidance will be appreciated.