loading...
Cover image for 🤦‍♂️ Weekly fail (37/2020)
Kentico Kontent

🤦‍♂️ Weekly fail (37/2020)

ondrabus profile image Ondrej Polesny ・1 min read

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: '_',
    ...
  }
}

Posted on by:

ondrabus profile

Ondrej Polesny

@ondrabus

Blazor, .NET and Vue.js dev, bus driver, 3D printing enthusiast, German Shepherd lover, dev evangelist @Kontent

Kentico Kontent

Enterprise-level headless CMS that is friendly to developers.

Discussion

pic
Editor guide