Cannot read property 'sqlTable' of undefined
See original GitHub issueJoin-monster fails with
(node:3555) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): TypeError: Cannot read property 'sqlTable' of undefined
OR
{
"errors": [
{
"message": "Cannot read property 'sqlTable' of undefined",
"locations": [
{
"line": 2,
"column": 2
}
],
"path": [
"orders"
]
}
],
"data": {
"orders": null
}
}
Here is my code
const Order = new graphql.GraphQLObjectType({
name : "Order",
sqlTable: `order`,
uniqueKey: "id",
fields : () => ({
order_id : {
type: graphql.GraphQLString,
},
}),
});
module.exports = new graphql.GraphQLSchema({
query : new graphql.GraphQLObjectType({
name : "Query",
fields : () => ({
orders: {
type : Order,
resolve :(obj, args, context, resolveInfo) => {
return join_monster(resolveInfo, context, sql => {
return pg.query(sql);
});
},
},
}),
}),
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:20 (6 by maintainers)
Top Results From Across the Web
Cannot read property 'sqlTable' of undefined #352 - GitHub
I looked into the graphql code for the new version and they no longer expose type._typeConfig after the type is constructed. Here's a...
Read more >MEAN-Stack - Cannot read property 'map' of undefined
You're returning an object which has a property 'retrievedTables' from the server but on the client you are trying to access 'tables' which ......
Read more >Uncaught TypeError: Cannot read property 'type' of undefined
Hello All. For the life of me I'm unable to determine what is causing this issue. The datatable is fed via ajax, and...
Read more >TypeError: Cannot read properties of undefined (reading ...
Hello, It seems that my Azure Data Factory DataFlow began acting strange. First, I am trying to publish recent changes.
Read more >node-mssql | Microsoft SQL Server client for Node.js
e.g. Column names cannot be passed/set in statements using variables. ... On top of the extra options, an authentication property can be added...
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
@zhorzhz Can you please re-open this.
I looked into the graphql code for the new version and they no longer expose type._typeConfig after the type is constructed. Here’s a temporary work-around until the join-monster developers can deal with this in a better way.
Originally your code would have looked something like this:
The fix is to now only define the graphql specific properties in the type constructor, then provide the join-monster properties afterward like so:
@s97712 yeah, that is why I used the original object.
Another way how your solution should work would be to name the class the same (untested):
I personally prefer duck typing over constructor name comparison, but it is clearly more efficient to just check the constructor name. Maybe the maintainers are open for a PR to change this (for more extensibility). Let us know in case you read this :bowtie: