Error: Network error: field "todos" not found in type: 'query_root'
See original GitHub issueHi I was following the NextJS Fullstack tutorial https://hasura.io/learn/graphql/nextjs-fullstack-serverless/queries/2-create-query/. After logging in with Auth0 in the frontend NextJS app, I am getting an error in the console when I try to fetch todos:
Error: Network error: field "todos" not found in type: 'query_root'
The query is:
const GET_MY_TODOS = gql`
query getMyTodos {
todos(where: { is_public: { _eq: false} }, order_by: { created_at: desc }) {
id
title
created_at
is_completed
}
}`;
When I run the same query in GraphiQL, using the x-hasura-admin-secret
header it works as expected.
Could you kindly advise what I doing wrong?
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
field not found in type: 'query_root'" after merge schema ...
I found a solution. It was happening because of the wrong authorization getting forwarded to the 2nd endpoint.
Read more >Cardano-graphql / Hasura - not found in type: 'query_root'
I searched for similar errors, and it seems to have to do with permissions, but I can't figure out which permissions are missing....
Read more >GraphQL error: Field 'product' doesn't exist on type 'QueryRoot'
Im new to GraphQL and this example only sure a basic example which is great. Sadly they have not provided an example of...
Read more >Exploring the future potential of generic GraphQL error codes
Use a custom error code — i.e., one not defined at the spec level. For instance, whenever a mandatory argument is missing in...
Read more >Designing your schema - AWS AppSync
For this guide, we will create an example Todo application. We will add a root type named Query with a single getTodos field...
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
@nisaji the tutorial is missing quite a few steps. You are better to follow the backend tutorial to learn how to create a user role, and control the permissions. Here is the section that is relevant for your query: https://hasura.io/learn/graphql/hasura/authorization/1-todos-table-permissions/
Am I the only one wondering why permission error results in the irrelevant error message? 🤔 Shouldn’t the text be like
You don't have a permission to invoke this action!
?!