WebpackError #95313 "Building static HTML failed for path [...]" on castArray.js


I know it sounds similar to some other topics already posted but despite many tries I'm not able to solve my issue here. We are currently trying to update our Gatsby project, upgrading to React 18, Gatsby 5 and Gatsby/Prismic 6. But as we try to run the build command, we are getting those errors:

As you can see, it seems like Prismic functions could be the source of the issue, but I can't find any way to solve it right now. All of our packages seem to be on their latest version, especially the Gatsby and Prismic ones.

Do you have any solution?

Hi @pierre, could you check if you are using the style prop anywhere throughout your website? It looks like the error comes specifically from the /tarifs page, which means you could narrow your search to only the slices and components used on that page.

You may also need to consider the third-party components being used on that page.

@prismicio/client and gatsby-source-prismic do not touch the Gatsby project's JSX, so I don't think they are causing this error. It seems like the error output is showing an incorrect line of code since castArray isn't related to the style prop.

Hi @angeloashmore, thanks for your answer.

I don't think the /tarifs page has any particular problem. This is the page targeted here but I just removed all the pages created withe createPage for some tests, but it can be almost any page which send this kind of error.

I will keep checking all the third-party components but nothing found yet unfortunately. Thanks for your help.