gatsby-plugin-local-search icon indicating copy to clipboard operation
gatsby-plugin-local-search copied to clipboard

Can't query page context fields of pages created in gatsby-node.js

Open MartinConde opened this issue 3 years ago • 1 comments

I'm using gatsby-node.js to create a bunch of pages which I would like to search through using your plugin. I'm passing all the needed data into the pagecontext during the creation of the pages.

My query looks like this:

 query: `
      {
        allSitePage {
          edges {
            node {
              path
              context {
                id__normalized
                market_cap_rank
                name
                symbol
              }
            }
          }
        }
      }
        `,

The error says: Cannot query field "context" on type "SitePage".

I'm not really sure if this just isn't supported or whether I am overlooking something here. The only thing that I can see that seems fishy to me is that the "success create pages" message in the console comes after the error, which makes me think that the pages don't exist yet when I'm trying to query them.

Any hints would be much appreciated! :)

MartinConde avatar Aug 24 '21 02:08 MartinConde

This is a known thing: https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v3-to-v4/#field-sitepagecontext-is-no-longer-available-in-graphql-queries

LekoArts avatar Mar 15 '22 13:03 LekoArts