Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nest] 30 - 04/14/2024, 4:54:00 AM ERROR [ExceptionsHandler] Can't add new command when connection is in closed state Error: Can't add new command when connection is in closed state #675

Open
OnZeng opened this issue Apr 14, 2024 · 9 comments

Comments

@OnZeng
Copy link

OnZeng commented Apr 14, 2024

[Nest] 30 - 04/14/2024, 4:54:00 AM ERROR [ExceptionsHandler] Can't add new command when connection is in closed state
Error: Can't add new command when connection is in closed state
Errors are reported automatically at regular intervals

@Tony133
Copy link
Owner

Tony133 commented Apr 14, 2024

Reading this issue: sidorares/node-mysql2#1898 is a problem with the mysql2 package

@OnZeng
Copy link
Author

OnZeng commented Apr 16, 2024

I'm still not gonna fix it,
eadcaea774f63913514a0a77ac0d9e7
我应该怎么修复这个错误

@Tony133
Copy link
Owner

Tony133 commented Apr 16, 2024

mmmh what version of the package are you using the latest 0.0.13? try to install nest-mysql version 0.0.12 maybe the problem was introduced with mysql v3.9.4, in version 0.0.12 there should be version 3.9.1 of the mysql2 package

@OnZeng
Copy link
Author

OnZeng commented Apr 16, 2024

nest-mysql is 0.0.13
mysql2 is 3.9.3

@Tony133
Copy link
Owner

Tony133 commented Apr 16, 2024

nest-mysql is 0.0.13 mysql2 is 3.9.3

try using these versions here:

  • nest-mysql v0.0.12
  • mysql2 v3.9.1

@OnZeng
Copy link
Author

OnZeng commented Apr 16, 2024

I've switched versions
I'll run some tests. Wait for my results

@OnZeng
Copy link
Author

OnZeng commented Apr 17, 2024

The same mistakes happen
The problem has not been solved
How do I create a connection pool to connect to the database

@Tony133
Copy link
Owner

Tony133 commented Apr 17, 2024

The same mistakes happen The problem has not been solved How do I create a connection pool to connect to the database

Okay, I released a new version 0.0.14 to make pool connections try doing that:

MysqlModule.forRoot({
    host: 'localhost',
    database: 'test2',
    password: 'root',
    user: 'root',
    port: 3306,  
    waitForConnections: true,
    connectionLimit: 10,
    queueLimit: 0,
    pool: true,
}),

put the flag "pool:true" in the configuration, so it does the switch for the connection pool, let me know if it works

@OnZeng
Copy link
Author

OnZeng commented Apr 17, 2024

非常棒,我去实验一下,看看问题有没有被解决,可能会晚点回复你结果

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants