Docker image dies after "Got an error reading communication packets"

I am facing currently a very weird behaviour that i cannot understand. My setup is: a microservice, using node 10.18.1 and knex js v0.20.10, for accessing the DB which is a mysql 5.7 db

The error
For local tests, i have a docker-compose file that creates all the images including my project. The problem that i have is that, everytime i try to fetch information from the DB, my project image is being killed. After looking at the logs i saw the following message from mysql:

mysql    | 2020-03-12T00:40:18.457996Z 2 [Note] Aborted connection 2 to db: <DB_NAME> user: 'root' host: '' (Got an error reading communication packets)

I was able to narrow the issue to the following code parts:

async function getUser (condition) {
    console.log('>> here', condition)

    const users = await knexClient(TABLE_NAME).where(condition) //<-- all good here

    const user = users[0]  //<-- still nothing wrong
    console.log('>', user) // <-- i can see the user from the DB
    await sleep(10000)  // <-- It can even wait for 10 s
    return users.pop()  // <-- BOOM! 
    // return null // <-- If i return null, there is no error!?!?!? wtf?

Function call

async function getByEmail (email) {
      **const user = await getUser({ email })**

      if (user == null) {
        throw applicationErrors.notFoundError('User not found or is not activated')

      return user

Basically the problem i am facing is that everytime i try to return the found user in the DB i get the mysql error(Got an error reading communication packets). After this error occurs, my docker image stops because is exiting with status code 0.

Fun fact

When i run the same source code, with the same Knex configuration, pointing to the local mysql docker image, the error never occurs!

My docker file is the following:

FROM node:10-alpine
ADD . /app
RUN npm i --only=prod

RUN rm -rf ./config/local.json
RUN rm -rf ./docker-compose.override.yml

CMD ["npm", "start"]

And my docker-compose looks like this:

version: "3"

    build: .
    container_name: <SERVICE_NAME>
      - "9000:9000"
    # expose:
    #   - 9000
      - mysql

    image: mysql:5.7.13
    container_name: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
      - mysql:/var/lib/mysql
      - "./infrastructure/docker/initdb.sql:/docker-entrypoint-initdb.d/init.sql"
      - MYSQL_ROOT_PASSWORD=password
      - "3306:3306"
    # expose:
    #   - 3306


Any help or suggestion, will be highly appreciated!

Source: StackOverflow