question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tutorial Part Six Error: Cannot query field "frontmatter" on type "MarkdownRemark"

See original GitHub issue

Description

Following this step in Gatsby’s official tutorial triggers this error:

Generating development JavaScript bundle failed
src/pages/index.js
52:11  error  Cannot query field "frontmatter" on type "MarkdownRemark"  graphql/template-strings

GraphiQL shows no frontmatter field.

Steps to reproduce

  1. Clone this test case repo
  2. Run npm install
  3. Run gatsby develop

OR see on CodeSandbox

Expected result

Project should build and display the index.js page.

Actual result

Build fails.

Environment

System: OS: macOS High Sierra 10.13.6 CPU: (4) x64 Intel® Core™ i5-2500S CPU @ 2.70GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node Yarn: 1.22.4 - ~/.nvm/versions/node/v12.16.1/bin/yarn npm: 6.14.2 - ~/.nvm/versions/node/v12.16.1/bin/npm Languages: Python: 2.7.17 - /usr/local/bin/python Browsers: Chrome: 80.0.3987.132 Firefox: 73.0.1 Safari: 13.0.5 npmPackages: gatsby: ^2.19.7 => 2.19.7 gatsby-plugin-emotion: ^4.1.24 => 4.1.24 gatsby-plugin-typography: ^2.3.24 => 2.3.24 gatsby-source-filesystem: ^2.1.53 => 2.1.53 gatsby-transformer-remark: ^2.6.58 => 2.6.58 npmGlobalPackages: gatsby-cli: 2.10.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

29reactions
hedleysmithcommented, Apr 3, 2020

For anyone else who encounters this error and ends up here. Another common issue is that you need to add another source filesystem in gatsby-config.js:

{
  resolve: `gatsby-source-filesystem`,
  options: {
    name: `pages`,
    path: `${__dirname}/src/pages`,
  },
},
13reactions
AishaBlakecommented, Mar 12, 2020

@brimarq you have a space at the end of your Markdown file’s name (sweet-pandas-eating-sweets.md ), so that file is being read as plaintext. Getting rid of the space fixes the issue.

It does seem like the error could be clearer but I’m not sure how we could catch something like that proactively.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot query field "frontmatter" on type "MarkdownRemark" in ...
As of now, content is an empty folder. Now, on gatsby develop , I'm getting errors. I'm not proficient in gatsby and graphql,...
Read more >
gatsby-transformer-remark
Each Markdown file is parsed into a node of type MarkdownRemark . All frontmatter fields are converted into GraphQL fields through inference. This...
Read more >
graphql cannot query field on type query - You.com
Introducing the Cannot query field 'password' on type 'User' error. Once I began working on security and created a special User type in...
Read more >
How to Add an RSS Feed to Your Gatsby Site - Megan Sullivan
The best part: once you set up your RSS feed the first time, all the updates ... Cannot query field "fields" on type...
Read more >
[Solved]-Gatsby keeps complaining Cannot query field "fields ...
Coding example for the question Gatsby keeps complaining Cannot query field "fields" on type "MarkdownRemark" when I have allMarkdownRemark-Reactjs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found