DatoCMS Modular content field not working in GatsbyJS


I have been trying to query my DatoCmsPage model, and for some reason the sections field is not being returned.

In DatoCMS, the sections field is a modular content field from the Page model wich accepts the HeroSection block, when i execute this query in the gatsby graphql page it returns to me what i want, but when I execute it inside my page file the section field does not appear, only the title.

export const query = graphql`
    query MyQuery {
        page: datoCmsPage(slug: {eq: "app-url"}) {
                ... on DatoCmsHeroSection {
                    buttons {

Does anyone have any idea of what might be causing this? Is this query wrong?

Thank you in advance :slight_smile:

Hi @marcio.sousa, and welcome to the Dato forum!

When you say:

Do you mean it doesn’t show up in the response at all (like if you console.log it)? Or is it just not showing up on the page itself once rendered? Did you edit your template to make use of it too, not just alter it in the query?

Yes, it doesnt show up in the response.

Im using this query on a page component file, not in a page template component, its something i specifically need. And the query is exactly the same as the query i use in localhost:8000/___graphql, wich works.


I tried to replicate it with our Gatsby starter code, but couldn’t quite make it happen :frowning: Could you please send us the file(s) in question, or the whole repo? You can DM me here or email us at support@datocms.com and we can take a closer look. Or you can just post it as a reply if you don’t mind sharing it publicly.

Thanks, and sorry for the trouble!