deploy:publish task fails with cannot read property filter of undefined
I'm deploying a node express project using shipit and am getting an error inside of the library. At line 40 of the deploy:publish task, it gives me an error from the library saying that TypeError: Cannot read property 'filter' of undefined. filter is being called on res.stoud line 40 in the publish task inside of the shipit library. I added a console.log on res for help debugging and got this as output.
[ { child: ChildProcess { domain: null, _events: [Object], _eventsCount: 2, _maxListeners: undefined, _closesNeeded: 3, _closesGot: 3, connected: false, signalCode: null, exitCode: 0, killed: false, spawnfile: '/bin/sh', _handle: null, spawnargs: [Object], pid: 29591, stdin: [Object], stdout: [Object], stderr: [Object], stdio: [Object] }, stdout: '', stderr: '' } ]
It appears that res is an array but isn't being accessed like one. It also appears that there isn't an error coming back from the server because stdout is empty. I can confirm this because when I run the command it fails on manually it works without any issues cd /home/deploy/www/notis && if [[ -d current && ! (-L current) ]]; then echo "ERR: could not make symlink"; else ln -nfs releases/20170703202810 current_tmp && mv -fT current_tmp current; fi
Also, modifying the code to essentially ignore the issue as var failedresult = []; allows the script to proceed without error
I'm trying to figure out what the actual issue is. Below is the full error message.
Running 'deploy:publish' task...
Publishing release "/home/deploy/www/notis/releases/20170703202810"
Running "cd /home/deploy/www/notis && if [[ -d current && ! (-L current) ]]; then echo "ERR: could not make symlink"; else ln -nfs releases/20170703202810 current_tmp && mv -fT current_tmp current; fi" on host "45.55.237.177".
'deploy:publish' errored after 946 ms
TypeError: Cannot read property 'filter' of undefined
at /Users/paulhovley/Slate/notis-backend/node_modules/shipit-deploy/tasks/deploy/publish.js:41:44
at tryCatcher (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/promise.js:510:31)
at Promise._settlePromiseAt (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/promise.js:584:18)
at Promise._settlePromises (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/promise.js:700:14)
at Async._drainQueue (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues (/usr/local/lib/node_modules/shipit-cli/node_modules/ssh-pool/node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
I think stdout had a filter method in older versions of node, look like it's no longer the case. We should not use it. It's a readable stream and we must handle it like that. So it's a bug.
Can confirm, seeing same issue on 2.5 ^
Should be fixed in v4. If still a problem, please reopen an issue on shipit repository.