neo4j-graphql-js
neo4j-graphql-js copied to clipboard
[BUG] Filtering in generated queries get erros
When i try to filter with any field (no matter the type) it throws an error: Query:
query {
Chat (filter: {roomNumber: 10}) {
id
roomNumber
}
}
Error:
Cannot use GraphQLScalarType \"Int\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.
It also happens with strings:
query {
Message (filter: {text: "filter string"}) {
text
}
}
Error:
Cannot use GraphQLScalarType \"String\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.
We are using:
- apollo-server: 2.6.4 (Also tried with version 2.6.3)
- neo4j-driver: 1.7.4
- neo4j-graphql-js: 2.6.3
Could you share the dependencies from package.json? Do you explicitly include graphql in your dependencies?
This could be related to the fact that we need to move graphql-js to a peer dependency, which we plan to do for the 3.0 release. See #249
Here are the deps as well as the development ones:
"dependencies": {
"apollo-server": "^2.6.4",
"dotenv-json": "^1.0.0",
"graphql-auth-directives": "^2.1.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"neo4j-driver": "1.7.4",
"neo4j-graphql-js": "^2.6.3",
"uuid": "^3.3.2"
},
"devDependencies": {
"@pact-foundation/pact": "^8.2.6",
"@types/gulp": "^4.0.6",
"@types/jsonwebtoken": "^8.3.2",
"@types/lodash": "^4.14.134",
"@types/node": "^12.0.10",
"@types/uuid": "^3.4.5",
"@types/webpack": "^4.4.33",
"awesome-typescript-loader": "^5.2.1",
"cross-env": "^5.2.0",
"gulp": "^4.0.2",
"nodemon": "^1.19.1",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"source-map-loader": "^0.2.4",
"string-loader": "0.0.1",
"timecop": "git+https://github.com/jamesarosen/Timecop.js.git",
"ts-node": "^8.3.0",
"typescript": "^3.5.2",
"webpack": "^4.35.0",
"webpack-cli": "^3.3.4"
}
Hey @johnymontana I'm the architect on charge of @Crodaycat, what's the progress of this? not being able to use filters may block our use of filters, which forces us to use custom queries, not ideal, can you help us a bit? or point us the right direction?
Hey there, this looks like it is a graphql package version dependency issue rather than being specific to filtering. Does the error occur with any other query or operation? Are there any API calls that don't get the error?
This works:
query {
Chat(checkIn: {year: 2019 }) {
id
roomNumber
}
}
query {
Chat (roomNumber: 1001) {
id
roomNumber
}
}
This doesn't:
{
Chat(filter: { roomNumber: 1001 }) {
id
roomNumber
}
}
As mentioned only fails when trying to use filter, even the most basic one like the exact value breaks.
I have the same issue. I'm using:
- apollo-server: 2.12.0
- neo4j-driver: 4.0.2
- neo4j-graphql-js: 2.13.0
- graphql: 14.6.0
Tested with
- apollo-server: 2.13.0
- neo4j-driver: 4.0.2
- neo4j-graphql-js: 2.14.0
- graphql: 14.6.0
and works well. So just had to update neo4j-graphql-js and apollo-server!
Just confirming I had the same problem. The temporary fix for me was to downgrade versions as specified by @aklen.
I am experiencing same issue:
- express-graphql: 0.9.0
- graphql: 15.2.0
- neo4j-driver: 4.1.0
- neo4j-graphql-js: 2.14.3
No apollo.
Edit: Seems to be a problem of peer dependencies between these packages:
- [email protected]" has incorrect peer dependency "graphql@^14.4.1"
- neo4j-graphql-js > [email protected]" has incorrect peer dependency "graphql@~14.x"
Filter works with this setup:
- express-graphql: 0.9.0
- graphql: 14.4.1
- neo4j-driver: 4.1.0
- neo4j-graphql-js: 2.14.3
Hello,
@johnymontana , any progress here? Is there a workaround while neo4j-graphql-js 3.0 is not yet released?
I'm using the same package.json as in the GRAND stack Starter repository: https://github.com/grand-stack/grand-stack-starter/blob/master/api/package.json.
But I can't use filter as @luchillo17 .
If I run on the root of my project:
npm ls graphql
I get the following "UNMET PEER DEPENDENCY" error:
Hey guys,
I found a workaround that worked for me. As neo4j-graphql-js (actually the package graphql-auth-directives) has graphql@~14.x as dependency (not peer dependency), I added graphql@^14.7.0, as a dependency in my package.json
and ran:
rm -rf node_modules/
npm cache clean
npm install
Now my filter works!
But I think a long therm solution will be to add graphql-js as a peer dependency instead of a dependency in neo4j-graphql-js.
Hello everyone, also works with this setup.
"dependencies": {
"apollo-server-express": "^2.17.0",
"aws-sdk": "^2.759.0",
"dotenv": "^8.2.0",
"graphql": "^14.7.0",
"neo4j-driver": "4.0.2",
"neo4j-graphql-js": "2.14.3",
"uuid": "^8.3.0"
}
Still I am facing same issue with below dependencies.
"dependencies": { "apollo-server-express": "^2.17.0", "bcryptjs": "^2.4.3", "body-parse": "^0.1.0", "dotenv": "^8.2.0", "express": "^4.17.1", "express-graphql": "^0.12.0", "graphql": "^14.7.0", "graphql-tools": "^7.0.1", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.20", "neo4j-driver": "^4.0.2", "neo4j-graphql-js": "^2.14.3" }
@tatva122 removing the graphql dependency fixed the issue in my case as i didn't actually need it.
Yeah, this is a tricky issue, we need to upgrade the graphql version the library uses and move to making graphqle a peer dependency - we're looking into it this month ❤️
@tatva122 removing the graphql dependency fixed the issue in my case as i didn't actually need it.
I am experiencing "MODULE_NOT_FOUND" error when "GraphQL" dependency is removed.
https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608