DEV Community

Cover image for 🤦‍♂️ Weekly fail (37/2020)
Ondrej Polesny for Kontent.ai

Posted on

🤦‍♂️ Weekly fail (37/2020)

Last week I was converting a Gatsby Lumen starter website to Gridsome and got stuck on an error
Error: Cannot get field 'id' from type 'Page'. Field does not exist.

The error occurred only in case a certain page was published in the headless CMS Kentico Kontent and it was happening in the GraphQL schema generation. So it was quite difficult to debug.

I tried the try/fail method of debugging only to find out you can't use "Page" as a type name for your nodes. Not sure what the reason is as I was not willing to keep digging after several hours of nail-biting.

Lesson learned: Sometimes the tools we use don't have everything documented. If you're experiencing the above error, add a prefix to content item types in the configuration of the Gridsome Kontent plugin:

options: {
  ...
  contentItemConfig: {
    contentItemTypeNamePrefix: '_',
    ...
  }
}
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)