V3 -> V4 Migration: can no longer pass in context in createPages
#33674
Unanswered
benwainwright
asked this question in
Help
Replies: 2 comments 8 replies
-
What version of Gatsby are you using? (e.g. with |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks. I have a Gatsby site that I'm trying to upgrade to Gatsby 4. It is a personal site with a blog generate from markdown files. The relevant part of
gatsby.config.js
is hereI then use
gatsby-node.js
to create the pagesThe pages are definitely being created, but it appears the
context
is no longer being attached to them. I've used console logging to verify that the pages are being created and thatentry
has actually got data in it.This worked in Gatsby 3, but causes a build error in Gatsby 4. When I load
yarn start
and got tohttps://localhost:8000/__graphql
I can't see thecontext.entry
nodes anywhere in the schema forallSitePage
. Noting from the documentation thatcontext
gets passed intopageContext
, I can seepageContext
, but it always appears to containnull
This now results in a build error because in the config I'm making queries like
I know the Gatsby APIs have changed somewhat and I have tried to read migrating from v3 to v4 but it isn't immediately obvious to me what the solution is from reading that document. If anyone has any suggestions I'd love to hear them.
Beta Was this translation helpful? Give feedback.
All reactions