AWS Lambda Node.js. mysql Error “Cannot enqueue Query after invoking quit” on second call onwards:

I am currently creating an AWS Lambda resolver that utilizes Nodejs mysql library. Right now, my lambda is capable of executing a query to the database during the first invocation. However, on the subsequent invocations the error “Cannot enqueue Query after invoking quit” occurs. I am aware that it is something to do with the connection to the database but if I am not wrong, ‘connection.query’ should be making an implicit connection to the database. I am also calling the ‘connection.end’ within the callback. Could someone lend me a helping hand on this one?

If possible, how can I query mysql database from a postgresql database?

Is it possible to write just one query in postgresql database that can also fetch the data from mysql server? With dblink_connect feature of the postgresql database I was able to achieve this goal from another postgresql database but not mysql database. With mysql database it gives me connection refused error.