Gatsby 4 - Updates, Breaking Changes & Deprecations #32860
Replies: 16 comments 42 replies
-
Hello! I was reading the part of server side rendering and I wanted to share one thing I have always tried to do with Gatsby. One thing I have always tried to do was to reuse the Gatsby's graphql server in a lambda function so that I can do some dynamic queries. One use case would be in ecommerce. Imagine you have an ecommerce with 5 millions products and you want to generate one a portion of these products during SSG, and you want to make the rest be client-side rendered. Doing this is possible due to dynamic routing, However, you loose the graphql server and need to create a lambda function to your ecommerce provider and sometimes the shape of the product data is different from the graphql fetched part and from the lambda function. If the gatsby graphql server was available during serve time, it would be really nice since we would be able to share the same shape of data and avoid doing these data transformations outside of the graphql layer |
Beta Was this translation helpful? Give feedback.
-
Without coming up with an alternative solution before launch, this change likely will cause start up times to increase significantly. The pattern of downloading files in a resolver is used in This includes images and files like PDFs provided to a user's CMS. If I understand correctly, this change means calls to Is it possible to implement a lazy-fetching system with the Without a system like this, I worry the progress made in making Gatsby's startup and builds quicker will be diminished. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure there's good replacement for this method. On the contrary, more of this is needed, and with a more friendly developer experience. What's the recommended way to handle a large website with different data sources that have to be stitched together (which should be one of the common use cases of Gatsby)? Since now, I've been using createSchemaCustomization with custom resolvers everywhere, to have on some nodes custom properties that come from the same origin or another and are queried using nodeModel.runQuery and then maybe processed further. In a nutshell, I'm using the resolvers to implement all the business logic that is needed to connect different data sources or to precompute data so that is ready for the templates. I think that is the most efficient method since it only runs at build time (as opposed to write that logic inside react templates). It also aligns well with the philosophy of a static site generator to precompute at build time everything that can be done upfront. The developer experience is a little poor because the server has to be restarted for changes in resolvers to be reflected. This change makes me think that somehow you don't think this is the right direction. If it's so, how do you recommend to handle use cases like this one? |
Beta Was this translation helpful? Give feedback.
-
Creating nodes in resolvers is also a very developer friendly solution, for example I have HTML in various fields coming from a custom CMS that I wish to convert to MDX. I just write a resolver
I should stress that the lazy aspect of this approach is very important as well, as the html to mdx conversion can be time consuming (as custom html pre-processors are also involved). It is often the case that not all the resolves need to be evaluated. |
Beta Was this translation helpful? Give feedback.
-
Still working through how to solve this one, but I'm having issues with Here's what happens when I run
Here's some info about what I did to prepare after following the migration guide:
Additionally, here is an excerpt from my package.json file:
|
Beta Was this translation helpful? Give feedback.
-
I'm glad to experiment with Gatsby 4 from now! It's DSG functionality seems to be awesome. I'm not sure if this is the the right thread to ask this, but after deploying the new Gatsby 4 starter on Gatsby Cloud the SSR and DSG pages showing 2 and 4 while I only have 1 ssr page and 2 dsg... Not sure why it doubles even though I turned off preview deploy (so it was not related). |
Beta Was this translation helpful? Give feedback.
-
I'm currently having issues in Gatsby 4 with my gatsby-remark-acronyms plugin that I never experienced before! From what I can tell, the initial plugin validation is failing because my plugin entry point is under a "dist" folder instead of the root of the plugin (mind you, there is a "main" entry pointing on the plugin package.json, pointing to this file), but this works fine in Gatsby 2 and 3. Repro is quite easy, I just created a new Gatsby site with On the gatsby-config.js I replaced this: `gatsby-plugin-mdx`, with this: {
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
{
resolve: `gatsby-remark-acronyms`,
options: {
acronyms: {
API: 'Application Programming Interface',
ASAP: 'As Soon As Possible'
},
},
},
],
},
}, When I run
The error makes sense, as there is no "gatsby-remark-acronyms/index", but I would expect it to respect the "main" entry and thus use "gatsby-remark-acronyms/dist/index". Is this expected behavior or some kind of bug introduced in Gatsby 4? |
Beta Was this translation helpful? Give feedback.
-
In Gatsby V4 the
With that, I also lose the typing which were generated from the GraphQL schema. How would you work around this to get back a typed PageContext to most easy way? |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm currently having some trouble getting the
It has always been available until Gatsby 3 but now it looks like it's gone. As far as I can see, the context contains a mix of stuff injected from different templates using However, it looks like the
This field contains more or less the same I couldn't find anything specific about the |
Beta Was this translation helpful? Give feedback.
-
What is the recommended approach to debugging failing builds after upgrading to V4? If I do a Gatsby clean and Gatsby build my build fails. The build is failing when generating static HTML for pages. I get this error:
|
Beta Was this translation helpful? Give feedback.
-
As a developer, it is excited to see new versions published, I build a website selling moving crates using gatsby version 1 (website: https://www.movingboxsale.com) a few years ago, and I also have a website about wholesale supplier using nextjs and traditional wordpress website about plastic crates |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm currently encountering a problem using a community plugin The community plugin uses As soon as I change the export to be I did some digging and found a change to const userPluginsFiltered = gatsbyRemarkPlugins.filter(
plugin => typeof interopDefault(require(plugin.resolve)) === `function`
) to const userPluginsFiltered = gatsbyRemarkPlugins.filter(
plugin => typeof plugin.module === `function`
) Is this an intentional change or a bug? |
Beta Was this translation helpful? Give feedback.
-
Hello, I've been trying to migrate to v4, currently in 3.8.0, but I have this error : with a blank page when I do a Any ideas? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi! I seem to have a problem with "local" images being parsed in Fully-qualified web URLs such as I placed a breakpoint in ResultsThis is the part of the AST with a relative image in The same block of content with a relative image in In case it's helpful, I've a commit for the downgrade which worked. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to update a project from 3.14.6 to v4, I am getting GraphQL errors related to the types I've defined to handle CSV data. (Warning: I'm not really using GraphQL "correctly" in this project because I'm mid-migration from reading flat files into arrays-of-objects, and still using much of the existing selecting/sorting logic. I'll gladly accept any pointers on doing things The Right Way!) I'm using The doc for I've updated my queries which were previously filtering for and/or selecting the
|
Beta Was this translation helpful? Give feedback.
-
Hi, I have migrated a project I'm working on from v3 to v4 and the building time has increased drastically. I have tried to build with --verbose but it doesn't highlight any issues. I've been wondering if it could be due to some changes in the Can someone help on this matter? Below the packages I am using and their versions
|
Beta Was this translation helpful? Give feedback.
-
In case you didn't know, we're planning the next major version of Gatsby for Q4 of this year! We're bringing some exciting new features that provide
Major versions afford an opportunity to deprecate and remove legacy behaviors. Our goal is to provide you all with ample notice to address these changes in advance of Gatsby 4 so that your projects are ready, day one!
Certainly let us know if you have any questions / concerns with items you see on these lists, or if you think of features related to items in these lists that we may need to consider, but are not listed. Thanks!
View the Migration Guide for all changes
Beta Was this translation helpful? Give feedback.
All reactions