Where clause not working with graphql: "15.0.0"
See original GitHub issueI was just setting up a new project and noticed that using “graphql”: “^15.0.0” didn’t work well with the latest join-monster package.
Main issue that I noticed is that where clause wasn’t honored.
Here are the packages that I was using:
"dependencies": {
"express": "^4.17.1",
"express-graphql": "^0.9.0",
"graphql": "^15.0.0",
"join-monster": "^2.1.0",
"knex": "^0.21.1",
"pg": "^8.0.3"
}
Relevant parts of the code:
const Account = new graphql.GraphQLObjectType({
name: 'Account',
fields: () => ({
id: { type: graphql.GraphQLString },
name: { type: graphql.GraphQLString },
email: { type: graphql.GraphQLString },
}),
});
Account._typeConfig = {
sqlTable: 'account',
uniqueKey: 'id',
}
const QueryRoot = new graphql.GraphQLObjectType({
name: 'Query',
fields: () => ({
hello: {
type: graphql.GraphQLString,
resolve: () => "Health check successful!"
},
account: {
type: Account,
args: {
id: { type: graphql.GraphQLNonNull(graphql.GraphQLString) }
},
where: (accountTable, args, context) => {
return `${accountTable}.id = '${args.id}'`
},
resolve: (parent, args, context, resolveInfo) => {
return joinMonster.default(resolveInfo, {}, sql => {
console.log(sql);
return knex.raw(sql);
});
}
},
})
});
const connectedSchema = new graphql.GraphQLSchema({
query: QueryRoot,
});
When using graphql 15, the sql statement that was produced inside the resolver didn’t have the where clause. As soon as I downgraded to 14.1.1 all worked fine.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
apollo-server-express 2.11 + graphql 15.0 = error: Must ...
Upon upgrading the graphql package to 15.0.0, the package apollo-server-express throws an error as soon as it's being included.
Read more >id cannot be used in graphQL where clause? - Stack Overflow
However, when I tried to update the row with 'id' where clause, the console shows error. "message": "Unknown column 'NaN' in 'where clause'", ......
Read more >type-graphql/Lobby - Gitter
This gets me the error CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'where' of 'FindOneOptionsInput' class. Does the value used as ...
Read more >Deprecations by version - GitLab Docs
We haven't observed imports using this tool. There has been no activity on the open related issues on GitLab. The gitlab-runner exec command...
Read more >(0 , import_defineToJSON.default) is not a function - Bugs
If the import statement is removed, the error goes away. ... the defineToJSON file (https://github.com/graphql/graphql-js/issues/2646).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Glad to hear! And just released as v3.0.0
This is already being worked on here: https://github.com/join-monster/join-monster/pull/418