Error: Network error: field "todos" not found in type: 'query_root'

See original GitHub issue

Hi 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:closed
  • Created 2 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
wave-lightcommented, Apr 8, 2021

@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/

9reactions
ivan-kleshnincommented, Dec 7, 2022

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!?!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found