strapi / strapi-starter-gatsby-blog

Updated version of the first Gatsby starter with much more features
https://strapi-starter-gatsby-blog-orcin.vercel.app/
MIT License
141 stars 58 forks source link

GraphQL query issues with Mongodb as a database #24

Closed purnimagupta closed 3 years ago

purnimagupta commented 3 years ago

Hi all,

I’m working on my next blog which is Gatsby authentication with Strapi.

I’m using this strapi-starter-gatsby-blog as my starting point which is inside an official Strapi repo. But I’m running into GraphQL query issues which I assume is due to the latest changes in the Gatsby version. I’m attaching the screenshot of the errors. I’m very new to GraphQL so it’s taking me some time to debug this.

Meanwhile, if anyone can point out what could go wrong here. It would really expedite the blog writing part. Thank you!

I followed the README instructions mentioned in the repo.

Step 1: yarn create strapi-starter my-site gatsby-blog

Step 2: Run npm run develop from the root which will run both the repos.

Backend(Strapi server) started as expected at localhost://1337. But the frontend(Gatsby) fails because it isn’t able to query collections.

Note: Using MongoDB as my database

  File: src/pages/category/{StrapiCategory.slug}.js:9:46

  GraphQLError: Field "category" is not defined by type "StrapiArticleFilterInput".

  ---
  There was an error in your GraphQL query:

  Cannot query field "image" on type "StrapiArticle".

  File: src/pages/article/{StrapiArticle.slug}.js:16:7

  ---
  Cannot query field "author" on type "StrapiArticle".
  File: src/pages/article/{StrapiArticle.slug}.js:22:7

 ---
  Cannot query field "author" on type "StrapiArticle".
  File: src/pages/index.js:50:11

 ---
Can't resolve '../../public/page-data/sq/d/2852343550.json' in '/home/purnima/projects/gatsby_strapi/my-site/frontend/src/pages'

Attaching screenshot for clarity:

image

More Info on the version:

Gatsby CLI version installed on ubuntu 20.04: Gatsby CLI version: 3.5.0

Gatsby’s version inside the above repo’s package.json file: “version”: “0.1.0”

if you need any more info is required, please let me know. Thanks!

markkaylor commented 3 years ago

Hi @purnimagupta I suggested a work around here: https://github.com/strapi/strapi-template-blog/issues/5

markkaylor commented 3 years ago

Closing this issue. See strapi/strapi-template-blog#5