Neo4j-graphql-js: Error in version 2.19.1, GraphQLError: Argument "direction" has invalid value "OUT"

Created on 7 Jan 2021  路  2Comments  路  Source: neo4j-graphql/neo4j-graphql-js

Hi guys,

I just updated my neo4j-graphql.js version from 2.18.0 to 2.19.1. But now, when I try to run npm start, I get this error:

> [email protected] start /home/fernando/Code/jovens-genios/services/graphql-api
> npm run build && node build/index.js


> [email protected] build /home/fernando/Code/jovens-genios/services/graphql-api
> babel src --out-dir build && shx cp .env build 2>/dev/null || : && shx cp -r src/types/ build

Successfully compiled 11 files with Babel (617ms).

/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:240
            throw new graphql.GraphQLError(`Argument "${name}" has invalid value ${graphql.print(valueNode)}.`, valueNode);
            ^
GraphQLError: Argument "direction" has invalid value "OUT".
    at getArgumentValues (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:240:19)
    at /home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:3074:32
    at Array.forEach (<anonymous>)
    at visitorSelector (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:3066:32)
    at callMethod (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:2726:24)
    at visitFields (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:2868:30)
    at visit (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:2796:17)
    at /home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:2784:41
    at Array.forEach (<anonymous>)
    at visit (/home/fernando/Code/jovens-genios/services/graphql-api/node_modules/@graphql-tools/utils/index.cjs.js:2777:37) {
  locations: [ { line: 7475, column: 167 } ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run build && node build/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fernando/.npm/_logs/2021-01-07T01_35_29_264Z-debug.log

If I rollback to neo4j-graphql.js 2.18.0, it runs correctly. I think this is related to "graphql-tools": "^7.0.2" as dependency.

This is my package.json:

{
    "name": "grand-stack-starter-api",
    "version": "0.0.1",
    "description": "API app for GRANDstack",
    "main": "src/index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start:dev": "cross-env DEBUG=neo4j-graphql-js ./node_modules/.bin/nodemon --watch src --ext js,graphql --exec babel-node  src/index.js",
        "build": "babel src --out-dir build && shx cp .env build 2>/dev/null || : && shx cp -r src/types/ build",
        "now-build": "babel src --out-dir build && shx cp -r src/types/ build",
        "start": "npm run build && node build/index.js",
        "seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.js",
        "lint": "eslint --fix src/"
    },
    "author": "William Lyon",
    "license": "MIT",
    "dependencies": {
        "@graphql-tools/load-files": "^6.2.5",
        "@graphql-tools/merge": "^6.2.6",
        "apollo-boost": "^0.4.9",
        "apollo-cache-inmemory": "^1.6.6",
        "apollo-client": "^2.6.10",
        "apollo-link-http": "^1.5.17",
        "apollo-server": "^2.19.1",
        "apollo-server-lambda": "^2.19.1",
        "aws-sdk": "^2.823.0",
        "axios": "^0.21.1",
        "cors": "^2.8.5",
        "csv-parse": "^4.14.2",
        "dotenv": "^7.0.0",
        "express-jwt": "^6.0.0",
        "graphql": "^14.7.0",
        "graphql-redis-subscriptions": "^2.3.1",
        "graphql-tag": "^2.10.1",
        "ioredis": "^4.19.4",
        "luxon": "^1.25.0",
        "neo4j-driver": "^4.0.2",
        "neo4j-graphql-js": "^2.19.1",
        "node-fetch": "^2.6.0"
    },
    "devDependencies": {
        "@babel/cli": "^7.12.10",
        "@babel/core": "^7.12.10",
        "@babel/node": "^7.12.10",
        "@babel/plugin-proposal-class-properties": "^7.12.1",
        "@babel/plugin-transform-runtime": "^7.12.10",
        "@babel/preset-env": "^7.12.11",
        "@babel/preset-react": "^7.12.10",
        "@babel/preset-typescript": "^7.12.7",
        "@babel/runtime-corejs3": "^7.12.5",
        "babel-plugin-auto-import": "^1.0.5",
        "babel-plugin-module-resolver": "^4.1.0",
        "cross-env": "^7.0.3",
        "eslint": "^7.17.0",
        "eslint-config-prettier": "^7.1.0",
        "eslint-plugin-import": "^2.22.1",
        "eslint-plugin-prettier": "^3.3.1",
        "nodemon": "^1.19.1",
        "prettier": "^2.2.1",
        "shx": "^0.3.3"
    }
}

Most helpful comment

Hi! Ran into the same thing running the sample, remove the quotes around IN and OUT and you should be fine.
PR that made the change -> https://github.com/neo4j-graphql/neo4j-graphql-js/commit/c9b8b1af65ea751d060be79f8ab9d521577968de

So, your relation ship should NOT look like this:
@relation(name: "IN_GENRE", direction: "OUT")
But rather like this:
@relation(name: "IN_GENRE", direction: OUT)

Removing the double quotes made it work for me.

All 2 comments

Hi! Ran into the same thing running the sample, remove the quotes around IN and OUT and you should be fine.
PR that made the change -> https://github.com/neo4j-graphql/neo4j-graphql-js/commit/c9b8b1af65ea751d060be79f8ab9d521577968de

So, your relation ship should NOT look like this:
@relation(name: "IN_GENRE", direction: "OUT")
But rather like this:
@relation(name: "IN_GENRE", direction: OUT)

Removing the double quotes made it work for me.

It worked! Thank you, @SebSaveBySolar !

Was this page helpful?
0 / 5 - 0 ratings