Skip to content

Conversation

@antonio-abrantes
Copy link

No description provided.

DavidsonGomes and others added 30 commits June 9, 2024 14:20
Updated package.json to include the latest version of baileys for improved functionality. Modified whatsapp.baileys.service.ts to adjust socket configuration, enhancing the stability and performance of the service.
Updated server.module.ts and monitor.service.ts to improve service initialization and monitoring logic. Modified main.ts to integrate changes. This enhances the application's performance and reliability.
Updated default values for WA_BUSINESS_TOKEN_WEBHOOK, WA_BUSINESS_URL, and WA_BUSINESS_VERSION in env.config.ts to 'evolution', 'https://graph.facebook.com', and 'v19.0' respectively. This change ensures that the application uses more appropriate defaults if environment variables are not set, improving reliability and consistency.
Updated package.json to include latest dependencies. Enhanced caching logic in cache.service.ts and rediscache.ts for better performance. Improved DTOs in chat.dto.ts, instance.dto.ts, and sendMessage.dto.ts for more robust data handling. Refined instance.controller.ts and chatwoot.service.ts to streamline API integrations. Adjusted authentication state management in use-multi-file-auth-state-db.ts, use-multi-file-auth-state-provider-files.ts, and use-multi-file-auth-state-redis-db.ts. These changes aim to optimize the system's performance and reliability.
Reordered imports in multiple files to resolve linting issues and improve code readability. This change does not impact the functionality but ensures the code adheres to the project's coding standards.
Refactored the use-multi-file-auth-state-db.ts to better handle edge cases in multi-file authentication state management. This change improves reliability and ensures more robust error handling, reducing potential issues during authentication.
Normalized event names by replacing underscores with dots and converting to lowercase. This ensures consistent naming conventions and prevents potential issues with queue bindings.
…service

Modified whatsapp.baileys.service.ts to include handling for documentWithCaptionMessage. This change ensures that messages with documents having captions are properly processed, enhancing the service's message handling capabilities. No impact on existing functionalities.
Update package.json to use the new Baileys repository and modify the Whatsapp Baileys service to generate a pairing code. This change fixes the issue with the previous Baileys repository and improves the pairing process for Whatsapp.

Changes:
- Update package.json to use the new Baileys repository
- Modify Whatsapp Baileys service to generate a pairing code
- Fix issue with previous Baileys repository
- Improve pairing process for Whatsapp
Fix global RabbitMQ queue name in `channel.service.ts` and update CHANGELOG.md.
The queue name has been changed from `transformedWe` to `event`.
This fix prevents queue errors and ensures correct functionality of inter-service communication.
This commit updates the changelog to reflect the release of version 1.8.2. The date of the release has been updated in the header of the changelog. No functional changes were made in this release.

Modified: CHANGELOG.md
Explanation:
This commit updates the package and documentation versions to v1.8.2. The package.json and swagger.yaml files were modified accordingly. These changes are mainly for maintenance purposes and do not affect the functionality of the application.
* Corretion in globall rabbitmq queue name
* Improvement in the use of mongodb database for credentials
* Fixed base64 in webhook for documentWithCaption
* Fixed Generate pairing code
* Corretion in globall rabbitmq queue name
* Improvement in the use of mongodb database for credentials
* Fixed base64 in webhook for documentWithCaption
* Fixed Generate pairing code
* Corretion in globall rabbitmq queue name
* Improvement in the use of mongodb database for credentials
* Fixed base64 in webhook for documentWithCaption
* Fixed Generate pairing code
A new untracked file '.github/workflows/publish\_docker\_image\_latest.yml' was added. This workflow will handle the process of publishing the latest Docker image. This change allows for easier and more automated deployment of the Node.js project.
wahyuwidgetworks added a commit to Widget-Works/evolution-api that referenced this pull request Dec 2, 2025
- Document Dec 1 2025 staging reconnection loop incident
- Root cause: WhatsApp 401 conflict error triggers infinite reconnection
- State race condition explanation (why disconnect fails with 400)
- Event loop saturation analysis (why UI freezes)
- Fix required: add 401 to codesToNotReconnect exclusion list
- Execution tips for future investigation (Azure logs, endpoints, testing)
- Related GitHub issues: Evolution EvolutionAPI#765, EvolutionAPI#272, Baileys EvolutionAPI#963, EvolutionAPI#1052

Refs: mama-first-staging instance 43f972cd-fcc5-4422-9954-cbb2ac086e17
wahyuwidgetworks added a commit to Widget-Works/evolution-api that referenced this pull request Dec 2, 2025
Add 401 to codesToNotReconnect exclusion list to prevent infinite
reconnection loop when WhatsApp returns conflict/replaced errors.

Impact:
- Prevents CPU spike (8-10x normal load)
- Prevents UI freeze (event loop saturation)
- Prevents log spam (500+ logs/min)
- Fixes disconnect button 400 error during loop

Root cause:
WhatsApp sends 401 status when detecting session conflict (another
device using same credentials). Evolution was not excluding 401 from
reconnection attempts, causing infinite loop where each cycle:
1. Connects → reaches 'open' state
2. WhatsApp terminates with 401 conflict
3. Evolution reconnects immediately
4. Loop repeats 8-10 times/second

Fix:
Add 401 to codesToNotReconnect array (line 391) so Evolution stops
reconnection attempts on conflict errors, keeping instance in 'close'
state until user manually resolves the session conflict.

Refs:
- docs/troubleshooting/01-12-25-mama-first-staging-reconnection-loop.md
- Evolution API EvolutionAPI#765, EvolutionAPI#272, EvolutionAPI#368
- Baileys EvolutionAPI#963, EvolutionAPI#1052

[WIDGET-WORKS] Local fix until/unless upstream merges similar solution
wahyuwidgetworks added a commit to Widget-Works/evolution-api that referenced this pull request Dec 2, 2025
- Document Dec 1 2025 staging reconnection loop incident
- Root cause: WhatsApp 401 conflict error triggers infinite reconnection
- State race condition explanation (why disconnect fails with 400)
- Event loop saturation analysis (why UI freezes)
- Fix required: add 401 to codesToNotReconnect exclusion list
- Execution tips for future investigation (Azure logs, endpoints, testing)
- Related GitHub issues: Evolution EvolutionAPI#765, EvolutionAPI#272, Baileys EvolutionAPI#963, EvolutionAPI#1052

Refs: mama-first-staging instance 43f972cd-fcc5-4422-9954-cbb2ac086e17
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

Successfully merging this pull request may close these issues.

4 participants