[NOWEB] - /api/sendImage ERROR
When I try to send a text with an image I get the error "user_agents_1.default is not a constructor". The problem started with the new version 2026.3.1
/api/sendImage
{ "statusCode": 500, "timestamp": "2026-03-05T08:57:16.581Z", "exception": { "message": "user_agents_1.default is not a constructor", "name": "TypeError", "stack": "TypeError: user_agents_1.default is not a constructor\n at fetchBuffer (/app/dist/utils/fetch.js:11:23)\n at WhatsappSessionNoWebPlus.fetch (/app/dist/core/abc/session.abc.js:671:40)\n at WhatsappSessionNoWebPlus.fileToMessage (/app/dist/plus/engines/noweb/session.noweb.plus.js:59:34)\n at WhatsappSessionNoWebPlus.sendImage (/app/dist/plus/engines/noweb/session.noweb.plus.js:126:36)\n at descriptor.value (/app/dist/core/abc/activity.js:9:35)\n at process.processTicksAndRejections (node:internal/process/task_queues:103:5)" }, "request": { "path": "/api/sendImage/", "method": "POST", "body": { "file": { "mimetype": "image/jpeg", "url": "https://storage.googleapis.com/msgsndr/image.jpeg" }, "chatId": "[email protected]", "session": "session_01", "caption": "Text message" }, "query": {} }, "version": { "version": "2026.3.1", "engine": "NOWEB", "tier": "PLUS", "browser": null, "platform": "linux/x64", "worker": { "id": "WAHA2" } } }
Version
WAHA-PLUS 2026.3.1
That fix got it working fine again for me @devlikepro
index a197dbfa..c16f146a 100644
--- a/src/utils/fetch.ts
+++ b/src/utils/fetch.ts
@@ -1,11 +1,8 @@
import axios from 'axios';
import { Agent as HttpsAgent } from 'https';
-import * as UserAgentsModule from 'user-agents';
// user-agents exports the constructor directly (no .default) in CommonJS
-const UserAgent =
- (UserAgentsModule as { default?: new () => { toString(): string } }).default ??
- (UserAgentsModule as new () => { toString(): string });
+const UserAgent = require('user-agents') as new () => { toString(): string };
const InsecureHttpsAgent = new HttpsAgent({
rejectUnauthorized: false,```
[](https://waha.devlike.pro/docs/how-to/plus-version/#tiers)