You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an express server, responding to API calls.
Before calling server.listen() I initialise the Query Builder, and leave it running in the background
It all works fine until after an arbitrary amount of time passes and I get this
events.js:167
throw er; // Unhandled 'error' event
^
Error: Connection lost: The server closed the connection.
at Protocol.end (/data/darends/artron/backend/node_modules/mysql/lib/protocol/Protocol.js:112:13)
at Socket.<anonymous> (/data/darends/artron/backend/node_modules/mysql/lib/Connection.js:97:28)
at Socket.<anonymous> (/data/darends/artron/backend/node_modules/mysql/lib/Connection.js:502:10)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Connection._handleProtocolError (/data/darends/artron/backend/node_modules/mysql/lib/Connection.js:425:8)
at Protocol.emit (events.js:182:13)
at Protocol._delegateError (/data/darends/artron/backend/node_modules/mysql/lib/protocol/Protocol.js:390:10)
at Protocol.end (/data/darends/artron/backend/node_modules/mysql/lib/protocol/Protocol.js:116:8)
at Socket.<anonymous> (/data/darends/artron/backend/node_modules/mysql/lib/Connection.js:97:28)
[... lines matching original stack trace ...]
at process._tickCallback (internal/process/next_tick.js:63:19)
Note: This occurs when using single or pool (even with qb.release())
On researching how mysqljs/mysql handles its fatal errors,
If a fatal errors occurs and there are no pending callbacks, or a normal error occurs which has no callback belonging to it, the error is emitted as an 'error' event on the connection object. This is demonstrated in the example below:
Query Builder does not expose anything which would allow me to either catch or handle the error
I have an express server, responding to API calls.
Before calling
server.listen()
I initialise the Query Builder, and leave it running in the backgroundIt all works fine until after an arbitrary amount of time passes and I get this
Note: This occurs when using single or pool (even with
qb.release()
)On researching how mysqljs/mysql handles its fatal errors,
Query Builder does not expose anything which would allow me to either catch or handle the error
mysql
suggests this method.I was wondering if either
.on
method is able to be exposedThe text was updated successfully, but these errors were encountered: