Hi Raymond,
looks like you are not using the Oracle-maintained MySQL connector for Node.js, and using a community driver instead. Sometimes, you are probably better off getting help right from the source (https://github.com/mysqljs/mysql/issues).
I'm not really familiar with the driver codebase, however, looking at the error, it's a server disconnection, which might be happening due to client inactivity.
There are some hints here:
https://github.com/mysqljs/mysql#server-disconnects
And the documentation also mentions the following:
"It is very important not to leave the result paused too long, or you may encounter Error: Connection lost: The server closed the connection. The time limit for this is determined by the net_write_timeout setting on your MySQL server."
As Peter Brawley mentions, maybe using a connection pool might help, but I'm lacking enough context to provide a better answer to that.