Open mmorkt opened 2 years ago
It looks like this issue is getting thrown around where custom fragments are being added. Are you adding any custom fragments? If so, what do those look like?
Thanks @brianjhanson. After removing all node_modules
and reinstalled them, it builds again. But I'm having trouble with image sharp. Nearly all images are missing after upgrading to Gatsby 4. A work-around is setting my CPU to 1 in the env-file GATSBY_CPU_COUNT=1
. Then most images are showing but some are still missing. Can't find any logic in this behavior.
Here is an example:
All images is shown in Gatsby 3
Do you get any kind of error when the images aren't shown? It sounds almost like it's not able to generate them, or it's running into some kind of issue processing multiple images and bailing out. Have you tried setting failOnError
to false
? That might let us know if it's a single image causing issues or farther down.
It's set to failOn: 'warning'
by default so the build should fail if there is a corrupted image. gatsby build --verbose --log-pages
isn't giving me any info either. The frontend returns nothing as you can see on the screenshot above.
gatsby develop
works and is giving me the same result as gatsby 3.14.6.
It almost feels like a process is out of memory or something. Are your images remote or local?
It also looks like there are a handful of issues with a similar error message in the Gatsby repo. Have you looked through those to try to narrow it down?
Yup, GATSBY_CPU_COUNT=1 and 2 works better, they only skips 4 images, so it must be related to memory and maybe sourcing.
Placed some ID's to test where it breaks. Seems like it's in childImageSharp
, only some values are generated.
{ s.comparisonTable[0]?.comparisonImage[0].localFile.childImageSharp.id }
breaks { s.comparisonTable[0]?.comparisonImage[0].localFile.id }
shows the value.
failed Building static HTML for pages - 2.973s
ERROR #95313
Building static HTML failed for path "/produkter/produktguide"
See our docs page for more info on this error: https://gatsby.dev/debug-html
157 | {
158 | s.comparisonTable[0]?.comparisonImage[0].localFile
> 159 | .childImageSharp.id
| ^
160 | }
161 | --
162 | <div
WebpackError: TypeError: Cannot read property 'id' of null
- ComparisonTable.js:159
stm/src/components/Modules/ComparisonTable.js:159:38
- ComparisonTable.js:146
stm/src/components/Modules/ComparisonTable.js:146:62
- index.es.js:45
[stm]/[iframe-resizer-react]/dist/index.es.js:45:1
- index.es.js:47
[stm]/[iframe-resizer-react]/dist/index.es.js:47:1
- index.es.js:52
[stm]/[iframe-resizer-react]/dist/index.es.js:52:1
- index.es.js:53
[stm]/[iframe-resizer-react]/dist/index.es.js:53:1
- index.es.js:62
[stm]/[iframe-resizer-react]/dist/index.es.js:62:1
- index.es.js:42
[stm]/[iframe-resizer-react]/dist/index.es.js:42:1
- index.es.js:439
[stm]/[iframe-resizer-react]/dist/index.es.js:439:1
GraphQL:
const seriesData = useStaticQuery(graphql`
query {
allCraftComparisonTableGlobalSet {
nodes {
comparisonTable {
... on Craft_comparisonTable_comparisonFields_BlockType {
id
egenskaper {
key
value
}
}
}
}
}
allCraftProdukterKategoriEntry(
sort: { fields: lft }
filter: { enabled: { eq: true } }
) {
nodes {
menuDescription
title
slug
uri
comparisonTable {
... on Craft_comparisonTable_comparisonFields_BlockType {
egenskaper {
key
value
}
comparisonImage {
id
... on Craft_productImages_Asset {
localFile {
id
absolutePath
childImageSharp {
id
gatsbyImageData
}
}
}
}
}
}
}
}
}
`)
Also tried uploading it (without the IDs) to Gatsby Cloud it generates, this error:
09:40:25 AM:
error Service request {
09:40:25 AM:
resourceSpans: [ { resource: [Object], scopeSpans: [Array], schemaUrl: undefined } ]
09:40:25 AM:
}
@mmorkt, sorry for the delay here. Could you let me know if you were able to get any closer to a solution? It sounds like this is environmental and not something the source plugin can resolve.
The only other thing I can think of is that your instance of Craft is getting overwhelmed during the build and isn’t generating the transforms in time for Gatsby. Admittedly, I don't have the full flow in my head enough to know how possible or likely that is.
Thank you for replying @brianjhanson.
I'm still stuck. Tried a lot but I can't get Gatsby to generate the missing images.
Deployed it to Gatsby Cloud and the result was the same as running it local with GATSBY_CPU_COUNT=2
. It's missing images and I'm not getting any errors (other then childImageSharp
is not found). So childImageSharp
is not found but if i call relativePath
it returns {"id":"ada41425-85d2-53a3-bef0-204a1909e6e7","relativePath":".cache/caches/gatsby-source-craft/6bd41bbc90dd39154bdf6ba63d3b7630/IMAGE.png","childImageSharp":null}
and url
gives me the backend image url.
... on Craft_productImages_Asset {
url
localFile {
id
relativePath
childImageSharp {
id
gatsbyImageData(width: 300)
}
}
}
Made a local environment with Craft CMS and used it as the API. But I'm getting the same behaviour some images is missing.
Can you tell me a little more about your setup? How are your asset volumes set up? Are the images local? Or on s3 or something?
I'm also curious, what size are the images on average?
I'd like to try to set up an environment and attempt to replicate this.
Not sure if its easy to replicate. Invited you to our repository and I will make a staging environment so you can have a look at our backend if you like.
Description
Getting this error after upgrading to Gatsby 4.24.8
Steps to reproduce