From df8cb7cecb5bfe7f1be43937ebbd76a403ac777a Mon Sep 17 00:00:00 2001 From: devlikepro Date: Fri, 10 Oct 2025 12:12:00 +0700 Subject: [PATCH] [core] NOWEB - fix ssl issue fix #1474 --- src/core/abc/session.abc.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/abc/session.abc.ts b/src/core/abc/session.abc.ts index 11178f2d..debaadeb 100644 --- a/src/core/abc/session.abc.ts +++ b/src/core/abc/session.abc.ts @@ -43,6 +43,7 @@ import { complete } from '@waha/utils/reactive/complete'; import { SwitchObservable } from '@waha/utils/reactive/SwitchObservable'; import axios from 'axios'; import axiosRetry from 'axios-retry'; +import { Agent as HttpsAgent } from 'https'; import * as fs from 'fs'; import * as lodash from 'lodash'; import * as NodeCache from 'node-cache'; @@ -1076,10 +1077,19 @@ export abstract class WhatsappSession { /** * Fetches the content from the specified URL and returns it as a Buffer. */ + private static readonly insecureHttpsAgent = new HttpsAgent({ + rejectUnauthorized: false, + }); + public async fetch(url: string): Promise { - return axios.get(url, { responseType: 'arraybuffer' }).then((res) => { - return Buffer.from(res.data); - }); + return axios + .get(url, { + responseType: 'arraybuffer', + httpsAgent: WhatsappSession.insecureHttpsAgent, + }) + .then((res) => { + return Buffer.from(res.data); + }); } }