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

36 Views Asked by At

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        hasNextPage\n        hasPreviousPage\n        startCursor\n        endCursor\n      }\n      edges {\n        node {\n          title\n          githubUrl\n          description\n          liveSiteUrl\n          id\n          image\n          category\n          createdBy {\n            id\n            email\n            name\n            avatarUrl\n          }\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

0

There are 0 best solutions below