Skip to content
This repository was archived by the owner on Feb 11, 2021. It is now read-only.

Where query not working #133

Open
benjpierce opened this issue Jan 14, 2020 · 1 comment
Open

Where query not working #133

benjpierce opened this issue Jan 14, 2020 · 1 comment

Comments

@benjpierce
Copy link

benjpierce commented Jan 14, 2020

Hi,

I'm using "gatsby-source-prismic-graphql": "3.3.0".

I'm using separate GraphQL queries to filter some blog articles stored in Prismic for a Gatsby site. As follows:

export const query = graphql`
  query PrismicBlogArticlesNews {
    prismic {
      allBlog_pages {
        edges {
          node {
            heading
          }
        }
      }
      allBlog_articles(sortBy: published_DESC, where: {article_type_fulltext: "News"}) {
        edges {
          node {
            ...prismicBlogArticleFields
          }
        }
      }  
    }
  }
`
export const query = graphql`
  query PrismicBlogArticlesOpinion {
    prismic {
      allBlog_pages {
        edges {
          node {
            heading
          }
        }
      }
      allBlog_articles(sortBy: published_DESC, where: {article_type_fulltext: "Opinion"}) {
        edges {
          node {
            ...prismicBlogArticleFields
          }
        }
      }  
    }
  }
`

However, the first query does not return any data when used in my codebase. Despite the fact there is data matching this in Prismic. The second query does return data. Do you have any idea why changing 'article_type_fulltext' only works in some cases?

Cheers.

@TimFletcher
Copy link

I also have issues with simple where queries with gatsby-source-prismic-graphql 3.3.1.

Working Query

{
  prismic {
    allTestimonials(where: {author: "Timothy Fletcher"}) {
      edges {
        node {
          author
          featured_on_the_homepage
        }
      }
    }
  }
}

Returns:

{
  "data": {
    "prismic": {
      "allTestimonials": {
        "edges": [
          {
            "node": {
              "author": "Timothy Fletcher",
              "featured_on_the_homepage": true
            }
          }
        ]
      }
    }
  }
}

Broken Query

{
  prismic {
    allTestimonials(where: {featured_on_the_homepage: true}) {
      edges {
        node {
          author
          featured_on_the_homepage
        }
      }
    }
  }
}

Returns:

{
  "errors": [
    {
      "message": "Internal server error",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "prismic",
        "allTestimonials"
      ],
      "stack": [
        "Error: Internal server error",
        "    at new CombinedError (/path/to/project/node_modules/graphql-tools/dist/stitching/errors.js:82:28)",
        "    at Object.checkResultAndHandleErrors (/path/to/project/node_modules/graphql-tools/dist/stitching/errors.js:98:15)",
        "    at CheckResultAndHandleErrors.transformResult (/path/to/project/node_modules/graphql-tools/dist/transforms/CheckResultAndHandleErrors.js:9:25)",
        "    at /path/to/project/node_modules/graphql-tools/dist/transforms/transforms.js:25:54",
        "    at Array.reduce (<anonymous>)",
        "    at applyResultTransforms (/path/to/project/node_modules/graphql-tools/dist/transforms/transforms.js:24:23)",
        "    at /path/to/project/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:105:50",
        "    at step (/path/to/project/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:32:23)",
        "    at Object.next (/path/to/project/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:13:53)",
        "    at fulfilled (/path/to/project/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:4:58)",
        "    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
      ]
    }
  ],
  "data": null
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants