-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix merge #2155
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
Fix merge #2155
Conversation
- Updated subproject reference in evolution-manager-v2. - Replaced old JavaScript and CSS asset files with new versions for improved performance and styling. - Added new CSS file for consistent font styling across the application. - Updated the evolution logo image to the latest version.
- Added features for Chatwoot enhancements, participants data handling, and LID to phone number conversion. - Updated Docker configurations to include Kafka and frontend services. - Fixed PostgreSQL migration errors and improved message handling in Baileys and Chatwoot services. - Refactored TypeScript build process and implemented exponential backoff patterns.
- Updated the release date for version 2.3.5 to 2025-10-15. - Adjusted subproject reference in evolution-manager-v2 to the latest commit.
- Integrated telemetry logging for received messages in Evolution, WhatsApp Business, and Baileys services. - Enhanced message tracking by sending the message type to the telemetry system for better observability.
- Updated subproject reference in evolution-manager-v2 to the latest commit. - Enhanced the manager_install.sh script to include npm install and build steps for the evolution-manager-v2. - Replaced old JavaScript asset file with a new version for improved performance. - Added a new CSS file for consistent styling across the application.
β¦ici como implementaΓ§Γ£o nativa de fetch(), e o Undici nΓ£o aceita mais objetos agent tradicionais (como os criados por https-proxy-agent ou socks-proxy-agent). Ele espera objetos compatΓveis com a interface moderna Dispatcher, que possuem o mΓ©todo dispatch(). Ou seja, o Baileys estava recebendo um tipo de agente incompatΓvel com o novo sistema de rede do Node. Foi criada uma nova funΓ§Γ£o makeProxyAgentUndici() para gerar agentes de proxy compatΓveis com o Undici, mantendo a versΓ£o antiga (makeProxyAgent()) inalterada para compatibilidade com bibliotecas como Axios. A nova funΓ§Γ£o substitui os antigos HttpsProxyAgent e SocksProxyAgent por ProxyAgent da biblioteca undici, garantindo compatibilidade total com o Baileys e com qualquer uso de fetch() moderno.
β¦upload-failed-on-all-hosts fix: "Media upload failed on all hosts" utilizando proxy
Reviewer's GuideThis PR adds a new undici-based proxy agent factory, integrates it into the WhatsApp Baileys service for fetch requests, and updates project dependencies to include undici. Sequence diagram for proxy agent selection in BaileysStartupServicesequenceDiagram
participant BaileysStartupService
participant ProxyAgentFactory
participant UndiciProxyAgentFactory
BaileysStartupService->>ProxyAgentFactory: makeProxyAgent(proxyUrl)
BaileysStartupService->>UndiciProxyAgentFactory: makeProxyAgentUndici(proxyUrl)
Note over BaileysStartupService,UndiciProxyAgentFactory: fetchAgent now uses Undici-based proxy agent
Class diagram for new and updated proxy agent factoriesclassDiagram
class makeProxyAgent {
+makeProxyAgent(proxy: Proxy | string): HttpsProxyAgent<string>
}
class makeProxyAgentUndici {
+makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent
}
class Proxy {
+host: string
+port: number
+protocol: string
+username: string
+password: string
}
makeProxyAgentUndici --> Proxy
makeProxyAgent --> Proxy
Class diagram for BaileysStartupService proxy agent usage updateclassDiagram
class BaileysStartupService {
+options: agent
+options: fetchAgent
+localProxy: enabled
+localProxy: host
+localProxy: port
+localProxy: protocol
+localProxy: username
+localProxy: password
}
class makeProxyAgent {
+makeProxyAgent(proxy: Proxy | string): HttpsProxyAgent<string>
}
class makeProxyAgentUndici {
+makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent
}
BaileysStartupService --> makeProxyAgent : uses for agent
BaileysStartupService --> makeProxyAgentUndici : uses for fetchAgent
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/utils/makeProxyAgent.ts:58-62` </location>
<code_context>
+ const { host, password, port, protocol: proto, username } = proxy
+ protocol = (proto || 'http').replace(':', '')
+
+ if (protocol === 'socks') {
+ protocol = 'socks5'
+ }
+
</code_context>
<issue_to_address>
**suggestion:** Protocol normalization for 'socks' is hardcoded to 'socks5'.
Some proxies use 'socks4', so please handle 'socks4' explicitly or document that 'socks' defaults to 'socks5'.
```suggestion
protocol = (proto || 'http').replace(':', '')
// Normalize SOCKS protocol: 'socks' defaults to 'socks5', but handle 'socks4' and 'socks5' explicitly
if (protocol === 'socks') {
// Default to socks5 if protocol is 'socks'
protocol = 'socks5'
} else if (protocol === 'socks4' || protocol === 'socks5') {
// Leave as is for explicit socks4/socks5
// No change needed
}
```
</issue_to_address>
### Comment 2
<location> `src/utils/makeProxyAgent.ts:80-81` </location>
<code_context>
+ return new ProxyAgent(proxyUrl)
+
+ default:
+ throw new Error(`Unsupported proxy protocol: ${protocol}`)
+ }
+}
</code_context>
<issue_to_address>
**suggestion:** Error message for unsupported protocol could be more informative.
Including the full proxy input in the error message will make it easier to trace issues when user input is involved.
```suggestion
default:
throw new Error(
`Unsupported proxy protocol: ${protocol}. Full proxy input: ${typeof proxy === 'string' ? proxy : JSON.stringify(proxy)}`
)
```
</issue_to_address>Help me be more useful! Please click π or π on each comment and I'll use the feedback to improve your reviews.
| protocol = (proto || 'http').replace(':', '') | ||
|
|
||
| if (protocol === 'socks') { | ||
| protocol = 'socks5' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Protocol normalization for 'socks' is hardcoded to 'socks5'.
Some proxies use 'socks4', so please handle 'socks4' explicitly or document that 'socks' defaults to 'socks5'.
| protocol = (proto || 'http').replace(':', '') | |
| if (protocol === 'socks') { | |
| protocol = 'socks5' | |
| } | |
| protocol = (proto || 'http').replace(':', '') | |
| // Normalize SOCKS protocol: 'socks' defaults to 'socks5', but handle 'socks4' and 'socks5' explicitly | |
| if (protocol === 'socks') { | |
| // Default to socks5 if protocol is 'socks' | |
| protocol = 'socks5' | |
| } else if (protocol === 'socks4' || protocol === 'socks5') { | |
| // Leave as is for explicit socks4/socks5 | |
| // No change needed | |
| } |
| default: | ||
| throw new Error(`Unsupported proxy protocol: ${protocol}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Error message for unsupported protocol could be more informative.
Including the full proxy input in the error message will make it easier to trace issues when user input is involved.
| default: | |
| throw new Error(`Unsupported proxy protocol: ${protocol}`) | |
| default: | |
| throw new Error( | |
| `Unsupported proxy protocol: ${protocol}. Full proxy input: ${typeof proxy === 'string' ? proxy : JSON.stringify(proxy)}` | |
| ) |
π Description
π Related Issue
Closes #(issue_number)
π§ͺ Type of Change
π§ͺ Testing
πΈ Screenshots (if applicable)
β Checklist
π Additional Notes
Summary by Sourcery
Introduce an undici-based proxy agent utility and integrate it into the WhatsApp Baileys service for improved proxy handling
New Features:
Enhancements:
Build: