ravi
May 15, 2024, 8:31am
1
Site stop build without any code changes with following error,
error Building static HTML failed for path “/…/…”
60 | sources: ,
61 | }
62 | if (images.fallback) {
| ^
63 | cleanedImages.fallback = {
64 | …images.fallback,
65 | srcSet: images.fallback.srcSet
WebpackError: TypeError: Cannot read properties of undefined (reading ‘fallback’)
gatsby-image.server.tsx:62
site/src/components/gatsby-image.server.tsx:62:16
That error is very clear.
The code if ( images.fallback ) {
is failing.
It is failing because images
is undefined
You should debug your code to check where images
comes from and determine why it is undefined
.
ravi
May 17, 2024, 8:25am
3
we habe storyblok in the backend. i could see the image is always there, only after few time of publishing the same post, then the error was gone.
i find it weird behaviour, looking for reason to avoid such build failure.
@ravi With data that is retrieved from other services at build time, usually you do want the build to fail when the data isn’t retrieved for whatever reason.
Having no changes deployed to a site is usually better than deploying a version of the site that’s missing content.
ravi
May 17, 2024, 9:30am
5
but how it could be, i see the image in Storyblok and netlify don’t find it. may be i ask storyblok once.
@ravi Since the error says images
was undefined
it absolutely would have been, you just need to read the code to determine how that could happen.
If you can’t guess at how it could occur, you could insert some debug code prior, for example:
if ( !images ) {
// console.log any values you want to see in your build log
}