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

[🐛] [baileys] Incoming Calls Cause Bot to Reject Subsequent Calls When Using Baileys with Experimental Store #1119

Open
fredpiuma opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@fredpiuma
Copy link

¿Que versión estas usando?

v2

¿Sobre que afecta?

Otro

Describe tu problema

Description:

When using the bot with the Baileys provider and the experimentalStore configuration enabled, incoming calls cause an issue where the bot automatically rejects subsequent calls.

The problem is linked to the following line of code:

// Optional: Automatically reject the call  
await this.vendor.rejectCall(call.id, call.from);  

Disabling this line minimizes the issue, as subsequent calls are no longer automatically rejected. However, this workaround is not ideal, as calls should be handled appropriately without breaking the bot's functionality.

Additionally, the following error log is generated when the issue occurs:

Error: Can't add new command when connection is in closed state  
    at Connection._addCommandClosedState (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/mysql2/lib/connection.js:148:17)  
    at Connection.query (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/mysql2/lib/connection.js:546:17)  
    at /home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/database-mysql/dist/index.cjs:20:25  
    at new Promise (<anonymous>)  
    at MysqlAdapter.getPrevByNumber (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/database-mysql/dist/index.cjs:18:26)  
    at CoreClass.handleMsg (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/bot/dist/index.cjs:14021:49)  
    at EventEmitter.func (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/bot/dist/index.cjs:13999:33)  
    at EventEmitter.emit (node:events:524:28)  
    at BaileysProvider.emit (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/bot/dist/index.cjs:30:22)  
    at EventEmitter.func (/home/builderbot/htdocs/app/base-ts-baileys-mysql/node_modules/@builderbot/provider-baileys/dist/index.cjs:30904:30) {  
  fatal: true  
}  

This issue might be related to the lack of a routine to properly close or reset the socket in this "resource-saving" mode (experimentalStore). This could leave the connection in an invalid state after rejecting a call.

Please let me know if further details or debugging information is required!

Reproducir error

No response

Información Adicional

No response

@fredpiuma fredpiuma added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant