craftcms / gatsby-source-craft

Gatsby source plugin for Craft CMS.
MIT License
54 stars 13 forks source link

UNHANDLED REJECTION Worker exited before finishing task #96

Open mmorkt opened 2 years ago

mmorkt commented 2 years ago

Description

Getting this error after upgrading to Gatsby 4.24.8

⠸ Building production JavaScript and CSS bundles
[========                    ]   6.884 s 86/272 32% Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs

 ERROR 

UNHANDLED REJECTION Worker exited before finishing task

  Error: Worker exited before finishing task

  - index.js:117 ChildProcess.<anonymous>
    [stm-web-update]/[gatsby-worker]/dist/index.js:117:45

  - node:events:394 ChildProcess.emit
    node:events:394:28

  - child_process:290 Process.ChildProcess._handle.onexit
    node:internal/child_process:290:12

not finished Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 7.181s
not finished Building production JavaScript and CSS bundles - 1.344s

➜  stm-web-update git:(gatsby4) ✗ /Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as createLog] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.info (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:217:34)
    at addExtraFragments (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:241:14)
    at ensureFragmentsExist (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:592:5)
    at initializePlugin (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:362:5)
    at Object.exports.onPluginInit (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-source-craft/gatsby-node.js:365:5)
    at runAPI (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/api-runner-node.js:487:16)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as startActivity] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.start (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter-phantom.js:16:23)
    at updateSchemaComposer (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:129:12)
    at buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:71:9)
    at build (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/index.js:111:18)
    at Object.buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/worker/child/schema.ts:40:3)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: write EPIPE
    at process.target._send (node:internal/child_process:849:20)
    at process.target.send (node:internal/child_process:722:19)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as startActivity] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.start (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter-phantom.js:16:23)
    at updateSchemaComposer (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:129:12)
    at buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:71:9)
    at build (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/index.js:111:18)
    at Object.buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/worker/child/schema.ts:40:3)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:853:39
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:363:5)
    at process.target.send (node:internal/child_process:724:16)
    at Object.sendMessage (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-worker/dist/child.js:51:9)
    at Object.intentifiedActionCreators.<computed> [as endActivity] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter.js:346:9)
    at Object.end (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby-cli/lib/reporter/reporter-phantom.js:25:23)
    at updateSchemaComposer (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:194:12)
    at buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/schema.js:71:3)
    at build (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/schema/index.js:111:18)
    at Object.buildSchema (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/gatsby/src/utils/worker/child/schema.ts:40:3)
Emitted 'error' event on process instance at:
    at processEmit [as emit] (/Users/mortenmork-pedersen/sites/stm-web-update/node_modules/signal-exit/index.js:199:34)
    at node:internal/child_process:728:35
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}
^C

Steps to reproduce

  1. Upgrade Gatsby to 4.24.8
  2. run gatsby build
brianjhanson commented 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?

mmorkt commented 2 years ago

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: Untitled-1

All images is shown in Gatsby 3

brianjhanson commented 2 years ago

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.

mmorkt commented 2 years ago

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.

Untitled-1

brianjhanson commented 2 years ago

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?

mmorkt commented 1 year ago

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:

}
brianjhanson commented 1 year ago

@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.

mmorkt commented 1 year ago

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.

brianjhanson commented 1 year ago

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.

mmorkt commented 1 year ago

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.