Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prisma graphql error on signUp mutation

I tried to do a signup mutation in the playground but I am getting an error which I cannot understand, tried a lot of ways to fix it like adding an authorisation header by getting a token from prisma token also, quite stuck..

enter image description here

like image 446
Pollux 01 Avatar asked Dec 23 '22 10:12

Pollux 01


1 Answers

That error occurs if you have two different versions of graphql in your entire dependency tree.

Your dependencies and dev dependencies for package.json need to use the same version of graphql, and all those dependencies need to have graphql as their peer dependency, like this:

  "peerDependencies": {
    "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0"
  }

Note that in your own package.json, you don't need the peer dependency. Here's an example of dependencies in your package.json that fulfill the requirements I mentioned above:

  "dependencies": {
    "graphql-yoga": "1.4.3",
    "prisma-binding": "1.5.16"
  },
  "devDependencies": {
    "graphql-cli": "2.15.8",
    "prisma": "1.3.3"
  }

I copied the dependencies from here.

Update your package.json to the above dependencies , then rm -rf node_modules yarn.lock and npm install or yarn.

like image 167
marktani Avatar answered Dec 25 '22 23:12

marktani