When when I give my variable name type String! in grafabase query then it says variable is not defined why?

When when I give my variable name type String! in grafabase query then it says variable is not defined why?


0

here is my query:

export const projectsQuery = `
  query getProjects($category: String!, $endcursor: String!) {
    projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges {
        node {
          title
          githubUrl
          description
          liveSiteUrl
          id
          image
          category
          createdBy {
            id
            email
            name
            avatarUrl
          }
        }
      }
    }
  }
`;

and the error: generates:

Unhandled Runtime Error
Error: Variable endcursor is not defined.: {"response":{"data":null,"errors":[{"message":"Variable endcursor is not defined.","locations":[{"line":3,"column":5}],"path":["projectSearch"]}],"status":200,"headers":{}},"request":{"query":"n  query getProjects($category: String!, $endcursor: String!) {n    projectSearch(first: 8, after: $endcursor, filter: {category: {eq: $category}}) {n      pageInfo {n        hasNextPagen        hasPreviousPagen        startCursorn        endCursorn      }n      edges {n        node {n          titlen          githubUrln          descriptionn          liveSiteUrln          idn          imagen          categoryn          createdBy {n            idn            emailn            namen            avatarUrln          }n        }n      }n    }n  }n","variables":{}}}

if you know , plz let me know

But if I gave type name without " !" means "String" instead of "String !" then it works, but it creates the problem on production side

Share
Improve this question

2

  • Probably because you are not actually passing a value for $endcursor inside your request. Henceforth when you type the parameter String! the error is thrown and otherwise it is not.

    – Fabio Nettis

    Jul 18 at 14:18

  • 1

    Please show the code where you are executing the query and providing it with variables. Presumably you are passing in category somewhere because that's also a required variable.

    – Michel Floyd

    Jul 18 at 19:26

1 Answer
1

Reset to default


-1

I have the same issue with query, did you solve this problem?

Share
Improve this answer

New contributor

Nataliia Lisova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1



Leave a Reply

Your email address will not be published. Required fields are marked *