Gatsby: Netlify build errors "[ERR_IPC_CHANNEL_CLOSED]: Channel closed"

Created on 19 Sep 2018  ·  8Comments  ·  Source: gatsbyjs/gatsby

Description

Just upgraded to [email protected] still the same
so on first deploy Netlify responds with this error

1:11:30 PM: error Generating JavaScript bundles failed
1:11:30 PM: 
1:11:30 PM:   Error: ./.cache/production-app.js
1:11:30 PM:   Module build failed (from ./node_modules/gatsby/dist/utils/babel-loader.js):
1:11:30 PM:   TypeError: helpers(...).minVersion is not a function
1:11:30 PM:       at File.availableHelper (/opt/build/repo/node_modules/gatsby/node_modules/  @babel/core/lib/transformation/file/file.js:180:30)
1:11:30 PM:       at file.set.name (/opt/build/repo/node_modules/gatsby/node_modules/@babel/  plugin-transform-runtime/lib/index.js:155:45)
1:11:30 PM:       at File.addHelper (/opt/build/repo/node_modules/gatsby/node_modules/@babel  /core/lib/transformation/file/file.js:197:19)
1:11:30 PM:       at pushInheritsToBody (/opt/build/repo/node_modules/gatsby/node_modules/@b  abel/plugin-transform-classes/lib/transformClass.js:550:108)
1:11:30 PM:       at pushConstructorToBody (/opt/build/repo/node_modules/gatsby/node_modules  /@babel/plugin-transform-classes/lib/transformClass.js:542:5)
1:11:30 PM:       at pushConstructor (/opt/build/repo/node_modules/gatsby/node_modules/@babe  l/plugin-transform-classes/lib/transformClass.js:530:5)
1:11:30 PM:       at pushBody (/opt/build/repo/node_modules/gatsby/node_modules/@babel/plugi  n-transform-classes/lib/transformClass.js:283:11)
1:11:30 PM:       at buildBody (/opt/build/repo/node_modules/gatsby/node_modules/@babel/plug  in-transform-classes/lib/transformClass.js:205:5)
1:11:30 PM:       at classTransformer (/opt/build/repo/node_modules/gatsby/node_modules/@bab  el/plugin-transform-classes/lib/transformClass.js:610:5)
1:11:30 PM:       at transformClass (/opt/build/repo/node_modules/gatsby/node_modules/@babel  /plugin-transform-classes/lib/transformClass.js:646:10)
1:11:30 PM:       at PluginPass.ClassExpression (/opt/build/repo/node_modules/gatsby/node_mo  dules/@babel/plugin-transform-classes/lib/index.js:110:54)
1:11:30 PM:       at newFn (/opt/build/repo/node_modules/@babel/traverse/lib/visitors.js:193  :21)
1:11:30 PM:       at NodePath._call (/opt/build/repo/node_modules/@babel/traverse/lib/path/c  ontext.js:53:20)
1:11:30 PM:       at NodePath.call (/opt/build/repo/node_modules/@babel/traverse/lib/path/co  ntext.js:40:17)
1:11:30 PM:       at NodePath.visit (/opt/build/repo/node_modules/@babel/traverse/lib/path/c  ontext.js:88:12)
1:11:30 PM:       at TraversalContext.visitQueue (/opt/build/repo/node_modules/@babel/traver  se/lib/context.js:118:16)

then I hit the "retry deploy" button and check the "clear build cache" box which yields this error

events.js:167
9:46:26 PM:       throw er; // Unhandled 'error' event
9:46:26 PM:       ^
9:46:26 PM: Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
9:46:26 PM:     at process.target.send (internal/child_process.js:628:16)
9:46:26 PM:     at reportSuccess (/opt/build/repo/node_modules/jest-worker/build/child.js:59:11)
9:46:26 PM:     at tryCatcher (/opt/build/repo/node_modules/bluebird/js/release/util.js:16:23)
9:46:26 PM:     at Promise._settlePromiseFromHandler (/opt/build/repo/node_modules/bluebird/js/release/promise.js:512:31)
9:46:26 PM:     at Promise._settlePromise (/opt/build/repo/node_modules/bluebird/js/release/promise.js:569:18)
9:46:26 PM:     at Promise._settlePromise0 (/opt/build/repo/node_modules/bluebird/js/release/promise.js:614:10)
9:46:26 PM:     at Promise._settlePromises (/opt/build/repo/node_modules/bluebird/js/release/promise.js:694:18)
9:46:26 PM:     at Promise._fulfill (/opt/build/repo/node_modules/bluebird/js/release/promise.js:638:18)
9:46:26 PM:     at MappingPromiseArray.PromiseArray._resolve (/opt/build/repo/node_modules/bluebird/js/release/promise_array.js:126:19)
9:46:26 PM:     at MappingPromiseArray._promiseFulfilled (/opt/build/repo/node_modules/bluebird/js/release/map.js:101:18)
9:46:26 PM:     at Promise._settlePromise (/opt/build/repo/node_modules/bluebird/js/release/promise.js:574:26)
9:46:26 PM:     at Promise._settlePromise0 (/opt/build/repo/node_modules/bluebird/js/release/promise.js:614:10)
9:46:26 PM:     at Promise._settlePromises (/opt/build/repo/node_modules/bluebird/js/release/promise.js:694:18)
9:46:26 PM:     at _drainQueueStep (/opt/build/repo/node_modules/bluebird/js/release/async.js:138:12)
9:46:26 PM:     at _drainQueue (/opt/build/repo/node_modules/bluebird/js/release/async.js:131:9)
9:46:26 PM:     at Async._drainQueues (/opt/build/repo/node_modules/bluebird/js/release/async.js:147:5)
9:46:26 PM: Emitted 'error' event at:
9:46:26 PM:     at process.nextTick (internal/child_process.js:632:35)
9:46:26 PM:     at process._tickCallback (internal/process/next_tick.js:61:11)
9:46:26 PM: Error running command: Build script returned non-zero exit code: 1
9:46:27 PM: Failing build: Failed to build site
9:46:27 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:46:27 PM: Finished processing build request in 8m57.783114818s

Steps to reproduce

That's the repo/branch I'm trying to deploy GaiAma/gaiama.org/tree/v2

Expected result

I deployed some days ago using [email protected] (this commit) which worked as expected
As gatsby is using jest-worker I think it comes from this package but I don't know

Maybe someone can help me get to the cause. I tried the netlify/build-image to debug my build locally but am running into more issues so I thought I try asking here maybe someone has an idea

Actual result

Above mentioned errors

Environment

(not all plugins are actually used, have to clean them up)
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
Shell: 5.2 - /bin/zsh
Binaries:
Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.10.0/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 60.0.2
Safari: 12.0
npmPackages:
gatsby: ^2.0.0-rc.7 => 2.0.4
gatsby-cli: ^2.0.0-rc.1 => 2.4.1
gatsby-image: ^2.0.0-rc.1 => 2.0.5
gatsby-mdx: ^0.1.3 => 0.1.4
gatsby-plugin-canonical-urls: ^2.0.0-rc.1 => 2.0.5
gatsby-plugin-catch-links: ^2.0.2-rc.1 => 2.0.2
gatsby-plugin-emotion: ^2.0.0-rc.0 => 2.0.5
gatsby-plugin-layout: ^1.0.0-rc.0 => 1.0.1
gatsby-plugin-lodash: ^3.0.1-rc.1 => 3.0.1
gatsby-plugin-manifest: ^2.0.2-rc.1 => 2.0.2
gatsby-plugin-netlify: ^2.0.0-rc.1 => 2.0.0
gatsby-plugin-netlify-cache: ^0.1.0 => 0.1.0
gatsby-plugin-nprogress: ^2.0.0-rc.1 => 2.0.5
gatsby-plugin-offline: ^2.0.0-rc.2 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0-rc.1 => 3.0.0
gatsby-plugin-sharp: ^2.0.0-rc.3 => 2.0.5
gatsby-plugin-twitter: ^2.0.0-rc.1 => 2.0.5
gatsby-plugin-typography: ^2.2.0-rc.3 => 2.2.0
gatsby-remark-autolink-headers: ^2.0.0-rc.1 => 2.0.5
gatsby-remark-copy-linked-files: ^2.0.0-rc.1 => 2.0.5
gatsby-remark-custom-blocks: ^2.0.0-rc.1 => 2.0.0
gatsby-remark-embed-video: ^1.4.0 => 1.4.0
gatsby-remark-emoji: ^0.0.2 => 0.0.2
gatsby-remark-external-links: ^0.0.4 => 0.0.4
gatsby-remark-responsive-iframe: ^2.0.0-rc.1 => 2.0.5
gatsby-remark-smartypants: ^2.0.0-rc.1 => 2.0.5
gatsby-source-filesystem: ^2.0.1-rc.1 => 2.0.1
gatsby-transformer-javascript-frontmatter: ^2.0.0-rc.2 => 2.0.0
gatsby-transformer-json: ^2.1.1-rc.1 => 2.1.1
gatsby-transformer-remark: ^2.1.1-rc.1 => 2.1.3
gatsby-transformer-sharp: ^2.1.1-rc.2 => 2.1.1
gatsby-transformer-yaml: ^2.1.1-rc.1 => 2.1.1

EDIT:
Some issues I found regarding this error:
https://github.com/kulshekhar/ts-jest/issues/403
https://github.com/facebook/jest/issues/4731

Upgraded to 2.0.6 without change...maybe I introduced it somehow else, but don't know where to look

Edit: I reverted the yarn.lock to the one of the working commit with no luck, and switched node (.nvmrc) and YARN_VERSION back to netlifys defaults with no luck

Most helpful comment

OK there was an error up there I was not checking an array that had null value on the render template and since there were 2000+ pages the error was way above there and I didn't see it earlier.

All 8 comments

I'm trying to dig into it but have hard times getting to the point, sadly I didn't noticed before that the cause for the ipc channel closing might be an earlier error

3:33:03 AM: THE_X
3:33:03 AM: { fields: { url: '/en/blog/the-raw-food-article-1-2/' },
3:33:03 AM:   frontmatter:
3:33:03 AM:    { title:
3:33:03 AM:       'Never will I ever make a pun with "raw" - The raw food article from HappyGaia 1/2',
3:33:03 AM:      lang: 'en',
3:33:03 AM:      slug: 'the-raw-food-article-1-2' } }
3:33:03 AM:   72 |     .map(x => ({
3:33:03 AM:   73 |       ...getLang(x.frontmatter.lang),
3:33:03 AM: > 74 |       to: x.fields.url,
3:33:03 AM:      |                    ^
3:33:03 AM:   75 |     }))
3:33:03 AM:   76 |     .concat(
3:33:03 AM:   77 |       menuItems
3:33:03 AM: 
3:33:03 AM:   WebpackError: TypeError: Cannot read property 'url' of undefined

which refers to this line/file the map on line 67 is just used for debugging to get an idea what item is failing etc.
problem is everything works as expected locally, so I've got no idea what causes this problem on Netlifys CI, even stranger, imho, that even on CI as to be seen above in the error, the object contains fields.url this one should be the one causing the error a few lines later

Any hint?

UPDATE: Just added JSON.stringify to the debug console.log, pushed it and now it just works..that's a joke -.- No manual cache clearing, no other changes, okay I changed Line 70 slightly but the result seems to be working as expected, I'll do some more testing to make sure though

I'm leaving this open for now because I would really love to know if someone experienced something similar, I've experience similar things every now and then..something doesn't work as expected, I add a console.log to the line before to see what happens, and sometimes this change just makes it work again..removing the line without returning the error...moving on..what could cause such, for me unpredictable, behavior?
So many wasted days -.- "yay coding" haha xD

UPDATE: okay my fault, I cheered to soon, without properly proofing, the mentioned change on line 70 which now happen to be on line 69 seems to be the fix..I'll keep investing..takes a little time as my connection and machine aren't the fastest and the page is quite huge to build..

@CanRau Does running your build command through the build image result in any errors?

I'm not sure if what I'm facing is related but I have a timeout error that only happen on real deployment. Running the Docker build image locally result in no errors. Revert back to Gatsby 2.0.0 beta36 solve the problem. Test deploying a gatsby-starter-netlify-cms site which also use the official 2.0.0 does not result in error. So it must be because of a specific dependency or new api.
It's driving me crazy cause it should not behave that differently.

@harrisnguyen94 that it's only happening on Netlify could be related to the fact that they limit your time to 10 or 15 mins per deployment, don't recall the exact time right now, maybe it's best to open a new issue for your case as this one is not about timeout nor related (I would say)

Closing this not so important issue

I have the same issue but on localhost. npm start works fine without any issues but npm run build EXITS as

        [Object],
        [Object] ],
     versions: [ [Object] ] } }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gatsby build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2019-02-10T00_14_42_532Z-debug.log
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at process.target.send (internal/child_process.js:628:16)
    at reportSuccess (/Users/user/Documents/Web/Sandbox/VSM/node_modules/jest-worker/build/child.js:59:11)
    at tryCatcher (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:694:18)
    at Promise._fulfill (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:638:18)
    at MappingPromiseArray.PromiseArray._resolve (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise_array.js:126:19)
    at MappingPromiseArray._promiseFulfilled (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/map.js:101:18)
    at Promise._settlePromise (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/user/Documents/Web/Sandbox/VSM/node_modules/bluebird/js/release/async.js:147:5)
Emitted 'error' event at:
    at process.nextTick (internal/child_process.js:632:35)
    at process._tickCallback (internal/process/next_tick.js:61:11)

Any ideas @CanRau 🤔

OK there was an error up there I was not checking an array that had null value on the render template and since there were 2000+ pages the error was way above there and I didn't see it earlier.

Sorry for not responding 😨
Glad you've figured it out 👍
Yea always good to scroll to the very top, I missed so many more meaningful information due to this 🤦‍♂️ 😉

I got this error and it ended up being related to 'gatsby-plugin-remote-images'

basically I was feeding it a non-image file and it was failing but not telling me what was going on.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  ·  3Comments

andykais picture andykais  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments

jimfilippou picture jimfilippou  ·  3Comments

ferMartz picture ferMartz  ·  3Comments