[core] NOWEB - fix send image using proxy

fix #1859
This commit is contained in:
devlikepro committed 2026-02-02 14:10:58 +07:00
1 parent 48ed33bc94
commit 99a0a19d8c
3 files changed
+6 -8

No files matched your search

+2 -4
View File
@@ -355,10 +355,8 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
}
return {
agent: agents?.socket,
// Baileys types still expect a Node https.Agent here,
// but 'undici' fetch requires a Dispatcher.
// Cast keeps the compiler satisfied while we pass the ProxyAgent at runtime.
fetchAgent: agents?.fetch as unknown as Agent,
// Baileys media upload uses Node https.request in Node runtime.
fetchAgent: agents?.fetch as Agent,
auth: state,
printQRInTerminal: false,
browser: browser,
+1 -2
View File
@@ -1,7 +1,6 @@
import { Agent } from 'https';
import type { Dispatcher } from 'undici';
export interface Agents {
socket: Agent;
fetch: Dispatcher;
fetch: Agent;
}
+3 -2
View File
@@ -1,6 +1,5 @@
import { HttpsProxyAgent } from 'https-proxy-agent';
import { URL } from 'url';
import { ProxyAgent } from 'undici';
import { WhatsappConfigService } from '../config.service';
import { ProxyConfig } from '../structures/sessions.dto';
@@ -72,7 +71,9 @@ export function createAgentProxy(proxyConfig: ProxyConfig): Agents | undefined {
);
const socketAgent = new HttpsProxyAgent(url);
const fetchAgent = new ProxyAgent({ uri: url });
// Baileys media upload uses Node.js https.request in Node runtime,
// so fetchAgent must be a Node https.Agent (ProxyAgent from undici won't work).
const fetchAgent = new HttpsProxyAgent(url);
return { socket: socketAgent, fetch: fetchAgent };
}