Gatsby v4 works locally, but timed out on Netlify

I’m also seeing this same issue. The build times out no the Building production JavaScript and CSS bundles step with this message:

success run queries in workers - 438.798s - 1795/1795 4.09/s
8:00:06 AM: error UNHANDLED EXCEPTION write EPIPE
8:00:06 AM: 
8:00:06 AM: 
8:00:06 AM:   Error: write EPIPE
8:00:06 AM:   
8:00:06 AM:   - child_process.js:841 ChildProcess.target._send
8:00:06 AM:     internal/child_process.js:841:20
8:00:06 AM:   
8:00:06 AM:   - child_process.js:712 ChildProcess.target.send
8:00:06 AM:     internal/child_process.js:712:19
8:00:06 AM:   
8:00:06 AM:   - index.js:290 WorkerPool.sendMessage
8:00:06 AM:     [site]/[gatsby-worker]/dist/index.js:290:19
8:00:06 AM:   
8:00:06 AM:   - worker-messaging.ts:22 
8:00:06 AM:     [site]/[gatsby]/src/utils/jobs/worker-messaging.ts:22:22
8:00:06 AM:   
8:00:06 AM: 
8:00:06 AM: not finished Merge worker state - 0.260s
8:00:06 AM: 

The Gatsby team fixed the issue in build #4.0.1. That version works for me locally but times out on Netlify: