Gatsby-theme-novela: Expected type MdxFieldsEnum, found frontmatter___date. After deleting content folder.

Created on 2 Mar 2020  路  6Comments  路  Source: narative/gatsby-theme-novela

Prerequisites

  • [X] Have you searched the issue tracker for similar issues (either past or present)?
  • [X] Can you reproduce the issue consistently?
  • [X] Are you reporting to the correct repository?
  • [ ] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.

Description

Version of Novela you are using: 0.13.3

Number of posts you have and which data source

  • [ ] Local
  • [X] Contentful 2

Describe the bug

There was an error in your GraphQL query:

Expected type MdxFieldsEnum, found frontmatter___date. Did you mean the enum value frontmatter___title?

File: /path/to/project/novela-blog/node_modules/@narative/gatsby-theme-novela/src/components/Navigation/Navigation.Footer.tsx

There was an error in your GraphQL query:

Field "date" is not defined by type MdxFrontmatterFilterInput.

File: /path/to/project/novela-blog/node_modules/@narative/gatsby-theme-novela/src/components/Navigation/Navigation.Footer.tsx

I am trying to use only Contentful CMS. But when running gatsby develop with the content folder deleted, it produces the above result.

To Reproduce

Steps to reproduce the behavior:

  1. Setup the blog as described here: https://github.com/narative/gatsby-theme-novela
  2. Setup contentful as your data source.
  3. Run gatsby develop. You will find no error.
  4. Delete the content folder in the root of your project.
  5. Now again run gatsby develop. See error.
  6. Add content folder back and you will see no error.

Expected behavior

Expected to build the site without local data.

Browser

Chrome

Additional context

_Add any other context about the problem here._

bug

All 6 comments

I am having this same exact issue, and can't figure out how to remove "My First Post" MDX

Facing the same issue. I think the source of the issue is the Navigation.Footer.tsx file which queries frontmatter___date and frontmatter___date is not being generated from contentful data for some reason.

I'd just strip this out. The whole purpose of this query is to calculate the copyright year span, e.g. 2017 - 2020. You can remove this allMdx query and set copyrightDate manually, or as 2017 - ${new Date().getFullYear()}

Yes, I think we'll just revert the PR that put this in to avoid headaches as it seems to be causing issues for quite a few people.

I ran into the same issue when I had an issue with unescaped quotes in the frontmatter (the excerpt) for a post. Sharing here in case anyone else hits the same issue.

Build fails even while overshadowing navigation.footer.tsx component.

Seems it'll need to be corrected at source as the _graphql query evals from node_modules is occurring before component constructs at build time. Has this been addressed in recent package versions?

As a workaround, I created at least one post and author profile using local: true data source, the rest using contentful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinRosenberg picture MartinRosenberg  路  3Comments

sw-yx picture sw-yx  路  3Comments

eugenejeonme picture eugenejeonme  路  3Comments

brotzky picture brotzky  路  4Comments

SabariVig picture SabariVig  路  4Comments