LekoArts/gatsby-starter-portfolio-bella

GraphQL Error Unknown field `allPrismicCaseStudy` on type `Query`

alfianridwan opened this issue · 8 comments

Hi, I've followed exactly as you've written in the getting started guide and I still encounter this problem. Any fix for this?

   1 | 
   2 |   query IndexQuery {
>  3 |     caseStudies: allPrismicCaseStudy(sort: { fields: [last_publication_date], order: DESC }) {
     |                  ^
   4 |       edges {
   5 |         node {
   6 |           uid
   7 |           data {
   8 |             header_image {
   9 |               localFile {
  10 |                 childImageSharp {
  11 |                   fluid(
  12 |                     maxWidth: 900
  13 |                     maxHeight: 900

Did you solve it in the meantime?

It's hard to debug this with so little information. How did you set up your prismic project?

Hi there. I got this same error as above while setting up this template on my system, as well. I followed the given instructions to a 'T'. A Prismic repeatable repository was set up with the the "Case Study" (api: case_study) as described. I created 1 document before running npm run develop. Let me know what other information you may need to help me troubleshoot. I appreciate your time and the template!

Here is my full error that appeared in the browser:

GraphQL Error There was an error while compiling your site's GraphQL queries.
  Error: RelayParser: Encountered 2 error(s):
- Unknown field 'allPrismicCaseStudy' on type 'Query'. Source: document `IndexQuery` file: `GraphQL request`
  
  GraphQL request (3:5)
  2:   query IndexQuery {
  3:     caseStudies: allPrismicCaseStudy(sort: { fields: [last_publication_date], order: DESC }) {
         ^
  4:       edges {
  
- Unknown field 'prismicCaseStudy' on type 'Query'. Source: document `CaseBySlug` file: `GraphQL request`
  
  GraphQL request (3:5)
  2:   query CaseBySlug($uid: String!) {
  3:     prismicCaseStudy(uid: { eq: $uid }) {
         ^
  4:       uid

I did update the repositoryName to my own in the gatsby-config.js file, but that did not help. My Prismic API key is set in the .env.development file as instructed. The error in Terminal leads me to the gatsby-node.js file. " TypeError: Cannot read property 'allPrismicCaseStudy' of undefined"

Hey - Looks like I got this resolved after all - Looks like the key was changing the repositoryName in the gatsby-config.js file. then I had to cancel and then run npm run dev

Hey - Looks like I got this resolved after all - Looks like the key was changing the repositoryName in the gatsby-config.js file. then I had to cancel and then run npm run dev

Hey! Could you give a bit more info on how you fixed it? I'm facing the same issue. I'm pretty sure its probably an easy fix cause the errors are not fatal.

No worries about this. I realised the "${process.env.API_KEY}" wasn't working right since I replaced it with the API token, and its fine now.

@LekoArts - is there a specific way to input entries into the .env.development file?