Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Alejo's avatar
Level 1

Cannot enqueue Query after invoking quit

I'm trying to connect to the database of my nodejs dockerized project and I'm getting this err that I don't understand, I've googled but I can't find a solution. I am using typeORM and dokcer for my project. I share the error, thanks in advance for any help.

query: 'SELECT VERSION() AS `version`', [1] parameters: undefined, [1] driverError: Error: Cannot enqueue Query after invoking quit. code: 'PROTOCOL_ENQUEUE_AFTER_QUIT', [1] fatal: false

docker-compose file

version: "3.1"

services:
  mysql_db:
    image: mysql:8
    volumes:
      - ./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
      - mysqldbvolume:/var/lib/mysql
    ports:
      - "3307:3306"
    environment:
      MYSQL_DATABASE: $${DB_DATABASE}
      MYSQL_ROOT_USER: $${DB_USER}
      MYSQL_USER: $${DB_USER}
      MYSQL_ROOT_PASSWORD: $${DB_PASSWORD}
      MYSQL_PASSWORD: $${DB_PASSWORD}
volumes:
  mysqldbvolume:
0 likes
3 replies
Sinnbeck's avatar

Show the code. But be aware that this is a laravel forum so chances someone is an expert in typeORM isn't big

Alejo's avatar
Level 1

Hi @okusax, thank you!! I understand it focuses on laravel, I'm starting with typeORM and I still can't find a forum similar to this one o.O I'll share my connection file with you.

server file

class ServerBootstrap extends ConfigServer {

    public app: express.Application = express();
    private port: number = this.getNumberEnv("PORT");

    constructor() {
        super();
        this.app.use(express.json());
        this.app.use(express.urlencoded({ extended: true }));

        this.dbConnection();
        this.app.use(morgan('dev'));
        this.app.use(cors());
        this.listen();
    }

async dbConnection(): Promise<DataSource | void> {
        return this.initConnect
            .then(() => {
                console.log("Connect Success!");
            })
            .catch((err) => {
                console.error(err);
                
            });
    }

 public listen() {
        this.app.listen(this.port, () => {
            console.log(`Server listening on port ${this.port}}`
            )
        });
    }
Alejo's avatar
Alejo
OP
Best Answer
Level 1

I have it, in my dataSource the field => synchronize had to have it in false and it was in true that's why the error when synchronizing data. thanks anyway, cheers!!!

Please or to participate in this conversation.