Build fails in @netlify/plugin-gatsby onPostBuild event


The builds for my Gatsby site started failing today without any changes from my end. Site name:

The error comes at step:

5. @netlify/plugin-gatsby (onPostBuild event)                 
Uncaught exception, the process will now terminate…
TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
    at Object.filter (file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/ipc.js:32:70)
    at ChildProcess.onItem (file:///opt/buildhome/node-deps/node_modules/p-event/index.js:41:35)
    at ChildProcess.emit (node:events:525:35)
    at ChildProcess.emit (node:domain:489:12)
    at emit (node:internal/child_process:946:14)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

See screenshot below for full build log.

My last successful build log is different to the failing one in that it doesn’t have steps related to @netlify/plugin-gatsby, meaning steps:

  1. @netlify/plugin-gatsby (onPreBuild event)
  2. @netlify/plugin-gatsby (onPostBuild event)

I have not seen these steps in my build logs before. I can build my site locally without issues.

Any help would be appreciated, thanks!

Hi @apltola :wave:t6: ,

I am not a gatsby expert but I’m curious what your build settings are configured to?

I recommend you give this guide a read and see if it answers some of your questions.

Hi @SamO

Here’s my build settings, let me know if I screen shotted the wrong thing

Here’s my config from netlify.toml

  base = "/"
  publish = "public/"
  command = "npm run build && npm run build:lambda"
  functions = "lambda"

We’re running two build commands at build time, first we build the Gatsby app and then netlify functions. These are separated because the netlify-lambda build command which builds the functions throws an error with node 18 which our project has, so it we run it separately with NODE_OPTIONS=--openssl-legacy-provider which seems to work. Here’s the actual build commands

"build": "gatsby build",
"build:lambda": "NODE_OPTIONS=--openssl-legacy-provider netlify-lambda build src/lambda",

I’ll take a look at the docs you linked. Hopefully we can figure something out. This site is actually for a large customer and at the moment I’m unable to create new deployments for the site.


And one more thing, I don’t know if this issue is Gatsby related, since the TypeError stacktrace is pointing to file:///opt/buildhome/node-deps/node_modules/@netlify/build/lib/plugins/ipc.js:32:70 .

Looks like the error is coming from some Netlify plugin?

Also, I’m curious why the plugin @netlify/plugin-gatsby appeared for the first time in my build logs yesterday, right as the errors started. Has something changed on Netlify’s end regarding this plugin? Has the plugin always been installed to my app but it has not logged anything to build logs?

1 Like

Hi @apltola,

As I can see, this seems to be resolved for you. Do you still need help?

Hi @hrishikesh ,

This is now resolved, thanks. After switching Netlify build to debug mode, we noticed an error sh: gatsby: not found. This error occurred when Netlify ran our build command gatsby build. We resolved it by installing gatsby-cli separately, before running the build command. Any thoughts on this issue?

Hi! @apltola thanks so much for coming back and sharing the solution!