Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

build(deps): move the baileys egress proxy agents to their v9/v10 lines

Yudhi Armyndharis059fe75e29a0
diff --git a/package-lock.json b/package-lock.json
index f16c56c59..395e9cf3b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -37,7 +37,7 @@
"class-validator": "^0.15.1",
"dockerode": "^5.0.1",
"helmet": "^8.3.0",
- "https-proxy-agent": "^7.0.6",
+ "https-proxy-agent": "^9.1.0",
"ioredis": "^6.0.0",
"pg": "^8.22.0",
"qrcode": "^1.5.4",
@@ -45,7 +45,7 @@
"rxjs": "^7.8.1",
"sharp": "^0.35.3",
"socket.io": "^4.8.3",
- "socks-proxy-agent": "^8.0.5",
+ "socks-proxy-agent": "^10.1.0",
"tar-stream": "^3.2.0",
"typeorm": "^1.1.0",
"undici": "^8.10.0",
@@ -9146,16 +9146,26 @@
}
},
"node_modules/https-proxy-agent": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
- "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-9.1.0.tgz",
+ "integrity": "sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA==",
"license": "MIT",
"dependencies": {
- "agent-base": "^7.1.2",
- "debug": "4"
+ "agent-base": "9.0.0",
+ "debug": "^4.3.4",
+ "proxy-agent-negotiate": "1.1.0"
},
"engines": {
- "node": ">= 14"
+ "node": ">= 20"
+ }
+ },
+ "node_modules/https-proxy-agent/node_modules/agent-base": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz",
+ "integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20"
}
},
"node_modules/human-signals": {
@@ -11348,6 +11358,33 @@
"node": ">= 14"
}
},
+ "node_modules/pac-proxy-agent/node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/pac-proxy-agent/node_modules/socks-proxy-agent": {
+ "version": "8.0.5",
+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",
+ "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "^4.3.4",
+ "socks": "^2.8.3"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/pac-resolver": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
@@ -11943,6 +11980,23 @@
"node": ">= 14"
}
},
+ "node_modules/proxy-agent-negotiate": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-agent-negotiate/-/proxy-agent-negotiate-1.1.0.tgz",
+ "integrity": "sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20"
+ },
+ "peerDependencies": {
+ "kerberos": "^2.0.0"
+ },
+ "peerDependenciesMeta": {
+ "kerberos": {
+ "optional": true
+ }
+ }
+ },
"node_modules/proxy-agent/node_modules/http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
@@ -11956,6 +12010,19 @@
"node": ">= 14"
}
},
+ "node_modules/proxy-agent/node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/proxy-agent/node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
@@ -11965,6 +12032,20 @@
"node": ">=12"
}
},
+ "node_modules/proxy-agent/node_modules/socks-proxy-agent": {
+ "version": "8.0.5",
+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",
+ "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "^4.3.4",
+ "socks": "^2.8.3"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@@ -12934,17 +13015,26 @@
}
},
"node_modules/socks-proxy-agent": {
- "version": "8.0.5",
- "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",
- "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-10.1.0.tgz",
+ "integrity": "sha512-WlMj/67cEJ6MDI1OcsnjuYKDNDoyPCCYZ249kuuXPiMDw9F8PXkVaQ7YWu3siTydfQ/4BEZcvGzu+aYvz7dDCQ==",
"license": "MIT",
"dependencies": {
- "agent-base": "^7.1.2",
+ "agent-base": "9.0.0",
"debug": "^4.3.4",
"socks": "^2.8.3"
},
"engines": {
- "node": ">= 14"
+ "node": ">= 20"
+ }
+ },
+ "node_modules/socks-proxy-agent/node_modules/agent-base": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz",
+ "integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20"
}
},
"node_modules/sonic-boom": {
diff --git a/package.json b/package.json
index 687923e75..b582d86aa 100644
--- a/package.json
+++ b/package.json
@@ -93,7 +93,7 @@
"class-validator": "^0.15.1",
"dockerode": "^5.0.1",
"helmet": "^8.3.0",
- "https-proxy-agent": "^7.0.6",
+ "https-proxy-agent": "^9.1.0",
"ioredis": "^6.0.0",
"pg": "^8.22.0",
"qrcode": "^1.5.4",
@@ -101,7 +101,7 @@
"rxjs": "^7.8.1",
"sharp": "^0.35.3",
"socket.io": "^4.8.3",
- "socks-proxy-agent": "^8.0.5",
+ "socks-proxy-agent": "^10.1.0",
"tar-stream": "^3.2.0",
"typeorm": "^1.1.0",
"undici": "^8.10.0",
@@ -186,7 +186,9 @@
"moduleNameMapper": {
"^@whiskeysockets/baileys$": "<rootDir>/../test/__mocks__/@whiskeysockets/baileys.ts",
"^@whiskeysockets/baileys/(.*)$": "<rootDir>/../test/__mocks__/@whiskeysockets/baileys.ts",
- "^archiver$": "<rootDir>/../test/__mocks__/archiver.ts"
+ "^archiver$": "<rootDir>/../test/__mocks__/archiver.ts",
+ "^https-proxy-agent$": "<rootDir>/../test/__mocks__/https-proxy-agent.ts",
+ "^socks-proxy-agent$": "<rootDir>/../test/__mocks__/socks-proxy-agent.ts"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
diff --git a/test/__mocks__/https-proxy-agent.ts b/test/__mocks__/https-proxy-agent.ts
new file mode 100644
index 000000000..b6eeabb82
--- /dev/null
+++ b/test/__mocks__/https-proxy-agent.ts
@@ -0,0 +1,19 @@
+/**
+ * Unit-test stub for `https-proxy-agent` (ESM-only since v8). ts-jest runs in CommonJS mode, so any
+ * source file that imports it — directly (baileys-lifecycle) or transitively (anything that pulls in
+ * the engine adapters) — fails to load without this stub once the package lands in the unit test
+ * graph. The unit suites never open a real proxied socket (the e2e config exercises the real module
+ * via transformIgnorePatterns), so a class that records the proxy URL and satisfies the `Agent`
+ * return type of createProxyAgent is sufficient — and because the spec's `instanceof` checks import
+ * the same mapped module, they run against this very class.
+ */
+import { Agent } from 'node:https';
+
+export class HttpsProxyAgent extends Agent {
+ readonly proxy: string;
+
+ constructor(proxy: string | URL, _options?: Record<string, unknown>) {
+ super();
+ this.proxy = String(proxy);
+ }
+}
diff --git a/test/__mocks__/socks-proxy-agent.ts b/test/__mocks__/socks-proxy-agent.ts
new file mode 100644
index 000000000..a4cf1ffc6
--- /dev/null
+++ b/test/__mocks__/socks-proxy-agent.ts
@@ -0,0 +1,19 @@
+/**
+ * Unit-test stub for `socks-proxy-agent` (ESM-only since v9). ts-jest runs in CommonJS mode, so any
+ * source file that imports it — directly (baileys-lifecycle) or transitively (anything that pulls in
+ * the engine adapters) — fails to load without this stub once the package lands in the unit test
+ * graph. The unit suites never open a real proxied socket (the e2e config exercises the real module
+ * via transformIgnorePatterns), so a class that records the proxy URL and satisfies the `Agent`
+ * return type of createProxyAgent is sufficient — and because the spec's `instanceof` checks import
+ * the same mapped module, they run against this very class.
+ */
+import { Agent } from 'node:https';
+
+export class SocksProxyAgent extends Agent {
+ readonly proxy: string;
+
+ constructor(proxy: string | URL, _options?: Record<string, unknown>) {
+ super();
+ this.proxy = String(proxy);
+ }
+}
diff --git a/test/jest-e2e.json b/test/jest-e2e.json
index f4d0a0c41..eda40d9e4 100644
--- a/test/jest-e2e.json
+++ b/test/jest-e2e.json
@@ -1,20 +1,14 @@
{
- "moduleFileExtensions": [
- "js",
- "json",
- "ts"
- ],
+ "moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
- "setupFiles": [
- "<rootDir>/setup-e2e.ts"
- ],
+ "setupFiles": ["<rootDir>/setup-e2e.ts"],
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"transformIgnorePatterns": [
- "node_modules/(?!(archiver|compress-commons|crc32-stream|zip-stream|archiver-utils)/)"
+ "node_modules/(?!(archiver|compress-commons|crc32-stream|zip-stream|archiver-utils|https-proxy-agent|socks-proxy-agent|agent-base|proxy-agent-negotiate)/)"
],
"maxWorkers": 1
}