Gulp 4 task with node-mysql2 module causing server crash on connect

64 Views Asked by At

I have a need to run mysql queries within gulp to check certain fields in a table. I currently connect to a development server via ssh tunnel, which is opened via terminal so that my host is set to 'localhost'.

When I execute a connection attempt, the tunnel crashes with: channel 4: open failed: connect failed: Connection refused

Then the server process crashes with an out of memory error.

We use node-mysql2 and a ssh tunnel to run GraphQL locally for testing, so I can't think of anything in particular in gulp that would cause what is essentially a race condition almost instantaneously from the time that the gulp command is sent.

Gulp Code: enter image description here

If anyone has any insights I'd be much obliged.

1

There are 1 best solutions below

0
On

Fix can be found here, thanks to the mysql2 developer for pointing me in the right direction!

More info on fix here: https://stackoverflow.com/a/30669454/705115

enter image description here