jsonb mutation variable fails with "no such type exists in the schema: 'jsonb'"
See original GitHub issueConnected to Hasura through a WebSocket, I’m trying to use a jsonb column, inserting an array. But even without any data being sent for that variable (which should then result in it becoming NULL since it’s nullable), I still get an error stating no such type exists in the schema: 'jsonb'. I’ve seen jsonb being used in the Hasura docs (as an example: https://hasura.io/docs/1.0/graphql/core/mutations/insert.html#insert-an-object-with-a-jsonb-field) so I’m not sure what I’m doing wrong.
Here’s the mutation (note that I’m not sending the $files variable through for testing purposes):
mutation submitPost($body: String!, $files: jsonb) {
insert_newsfeed_one(object: { body: $body }) {
id
}
}
Here’s the full WS message being sent:
{
"id": "5",
"type": "start",
"payload": {
"variables": { "body": "Testing", "files": [] },
"extensions": {},
"operationName": "submitPost",
"query":"mutation submitPost($body: String!, $files: jsonb) {
insert_newsfeed_one(object: {body: $body}) {
id
__typename
}
}
"
}
}
And the error response:
{
"type": "error",
"id": "5",
"payload": {
"errors": [
{
"extensions": {
"path": "$.variableValues",
"code": "validation-failed"
},
"message": "no such type exists in the schema: 'jsonb'"
}
]
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
"no such type exists in the schema: 'timetz'" in hasura
There are two solutions: changing the type of those columns to timetz; can be achieved by running this sql as a migration. alter...
Read more >Postgres: Update mutation | Hasura GraphQL Docs
The output type is the nullable table object. The mutation returns the updated row object or null if the row does not exist....
Read more >GraphQL schema basics
Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields...
Read more >How to Use TypeScript with GraphQL using TypeGraphQL
GraphQL also comes with type definitions, which exist in schema objects. ... In package.json , update the scripts object to this:
Read more >GraphQL Queries & Mutations - elide.io
Contains the actual graphQL query. operationName - Used if multiple operations are present in the same query. variables - Contains a json object...
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 Free
Top 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

Hi @trymbill
Are you using any
role(x-hasura-role)? If you are using a role, then does the table with ajsonbcolumn have permission on that column to insert or select? I guess it does not by looking at the error message:no such type exists in the schema: 'jsonb'This is just a GraphQL spec thing where if a type is not used in any field, it is simply omitted from schema. You do not see this with GraphiQL as it is running as
adminrole.Ahh! Good catch! Yeah, it’s definitely a new column so the permissions weren’t updated yet. Thank you for your help!
Just as a sidenote; might be worth updating that error message. Checking the permissions will from now on be something I check, but for new users, it’s definitely not 100% obvious. Thanks again for a killer product!