diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 22839fd451..abeef53d8c 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -85,7 +85,7 @@ import { createId as cuid } from '@paralleldrive/cuid2'; import { Instance, Message } from '@prisma/client'; import { createJid } from '@utils/createJid'; import { fetchLatestWaWebVersion } from '@utils/fetchLatestWaWebVersion'; -import { makeProxyAgent, makeProxyAgentUndici } from '@utils/makeProxyAgent'; +import { makeProxyAgent } from '@utils/makeProxyAgent'; import { getOnWhatsappCache, saveOnWhatsappCache } from '@utils/onWhatsappCache'; import { status } from '@utils/renderStatus'; import { sendTelemetry } from '@utils/sendTelemetry'; @@ -732,11 +732,15 @@ export class BaileysStartupService extends ChannelStartupService { const rand = Math.floor(Math.random() * Math.floor(proxyUrls.length)); const proxyUrl = 'http://' + proxyUrls[rand]; this.logger.info('Proxy url: ' + proxyUrl); - options = { agent: makeProxyAgent(proxyUrl), fetchAgent: makeProxyAgentUndici(proxyUrl) }; + // Baileys rc13 uploads media through Node's native http/https (not fetch/Undici) on the Node + // runtime, and passes fetchAgent straight to http.request as its `agent`. + options = { agent: makeProxyAgent(proxyUrl), fetchAgent: makeProxyAgent(proxyUrl) }; } catch (error) { this.logger.error(error); } } else { + // Baileys rc13 uploads media through Node's native http/https (not fetch/Undici) on the Node + // runtime, and passes fetchAgent straight to http.request as its `agent`. options = { agent: makeProxyAgent({ host: this.localProxy.host, @@ -745,7 +749,7 @@ export class BaileysStartupService extends ChannelStartupService { username: this.localProxy.username, password: this.localProxy.password, }), - fetchAgent: makeProxyAgentUndici({ + fetchAgent: makeProxyAgent({ host: this.localProxy.host, port: this.localProxy.port, protocol: this.localProxy.protocol,