[Gows] - POST /api/sendFile to send a PDF document via WAHA, the API returns 500 Internal Server Error
When calling POST /api/sendFile to send a PDF document via WAHA, the API returns 500 Internal Server Error with a gRPC error:
2 UNKNOWN: failed to execute request:
Post "https://media-bom2-1.cdn.whatsapp.net/mms/document/...":
write tcp <internal-ip>:<port>-><remote-ip>:443:
write: connection reset by peer
Important:
- Sending image files works correctly.
- The issue occurs only when sending PDF documents.
Version
Output of GET /api/version:
{
"version": "2026.1.4",
"engine": "GOWS",
"tier": "PLUS",
"browser": null,
"platform": "linux/x64",
"worker": {
"id": null
}
}
Request Payload
POST /api/sendFile
{
"chatId": "<redacted>@c.us",
"file": {
"mimetype": "application/pdf",
"filename": "filename.pdf",
"url": "https://<my-domain-redacted>/path/to/file.pdf"
},
"reply_to": null,
"caption": "string",
"session": "<redacted>"
}
Response
{
"statusCode": 500,
"exception": {
"message": "2 UNKNOWN: failed to execute request: Post \"https://media-bom2-1.cdn.whatsapp.net/...\": write: connection reset by peer",
"code": 2,
"details": "connection reset by peer"
}
}
Stack Trace Location
Failure occurs during:
WhatsappSessionGoWSPlus.sendMediaWhatsappSessionGoWSPlus.sendFile
Expected Behavior
PDF file should upload successfully to WhatsApp CDN and return a valid message response (same behavior as image uploads).
Might be related to a similar problem I'm encountering trying to send videos (I get the same error message). I was able to send by reducing the video size to ~1Mb, larger files fail.
@AlexGoldovsky I tried sending a file <1MB, but nothing changed. :(
same problem here and tried many things without succcess
@devlikepro Double checked and it is still happening.
Hi! Could you try dev image?
Make sure to select the engine via the environment variable - WHATSAPP_DEFAULT_ENGINE=GOWS:
devlikeapro/waha-plus:devdevlikeapro/waha-plus:dev-chromedevlikeapro/waha-plus:dev-arm
@devlikepro did not work.
[06:51:59.043] INFO (7): request errored {"reqId":162,"req":{"id":162,"method":"POST","url":"/api/sendVoice","query":{},"params":{"path":["api","sendVoice"]}},"res":{"statusCode":500},"responseTime":14405}
err: {
"type": "Error",
"message": "2 UNKNOWN: failed to execute request: Post \"https://media-gru1-1.cdn.whatsapp.net/mms/audio/6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU=?auth=Ac1cBL3_zwq4bR-R4okRjA6qs7Y4Cs2qN6-iO1hcDmRtuQ&token=6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU%3D\": write tcp 172.18.0.15:43972->157.240.222.60:443: write: connection reset by peer",
"stack":
Error: 2 UNKNOWN: failed to execute request: Post "https://media-gru1-1.cdn.whatsapp.net/mms/audio/6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU=?auth=Ac1cBL3_zwq4bR-R4okRjA6qs7Y4Cs2qN6-iO1hcDmRtuQ&token=6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU%3D": write tcp 172.18.0.15:43972->157.240.222.60:443: write: connection reset by peer
at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/build/src/call.js:32:19)
at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client.js:193:76)
at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:367:141)
at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:327:181)
at /app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:135:78
at process.processTicksAndRejections (node:internal/process/task_queues:84:11)
for call at
at MessageServiceClient.makeUnaryRequest (/app/node_modules/@grpc/grpc-js/build/src/client.js:161:32)
at MessageServiceClient.SendMessage (/app/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
at MessageServiceClient.SendMessage (/app/dist/core/engines/gows/grpc/gows.js:10456:30)
at node:internal/util:495:21
at new Promise (<anonymous>)
at node:internal/util:481:12
at /app/dist/plus/engines/gows/session.gows.plus.js:195:82
at async TmpDir.use (/app/dist/utils/tmpdir.js:22:20)
at async WhatsappSessionGoWSPlus.sendMedia (/app/dist/plus/engines/gows/session.gows.plus.js:185:16)
at async WhatsappSessionGoWSPlus.sendVoice (/app/dist/plus/engines/gows/session.gows.plus.js:207:16)
at async descriptor.value (/app/dist/core/abc/activity.js:9:20)
"code": 2,
"details": "failed to execute request: Post \"https://media-gru1-1.cdn.whatsapp.net/mms/audio/6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU=?auth=Ac1cBL3_zwq4bR-R4okRjA6qs7Y4Cs2qN6-iO1hcDmRtuQ&token=6MOKERyIyB6CL0f8ll90V1T6zH0NPfWqzuTE8NiEjPU%3D\": write tcp 172.18.0.15:43972->157.240.222.60:443: write: connection reset by peer",
"metadata": {
"content-type": [
"application/grpc"
]
}
}
seems to work on waha plus dev.
looks like
{
"class": "APIError",
"request": {
"method": "POST",
"url": "/api/sendImage",
"body": "{"session":"IA24HS_COMERCIAL","caption":"","chatId":"278275329@lid","file":{"url":"https://xxxx/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBekZGQkE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ==--b5d0e5ed432dbec7ebca07a3a58061be60ec9430/image.png","mimetype":"image/png"},"mentions":null}"
},
"response": {
"status": 500,
"statusText": "Internal Server Error",
"headers": {
"x-powered-by": "Express",
"access-control-allow-origin": "*",
"content-type": "application/json; charset=utf-8",
"content-length": "2368",
"etag": "W/"940-GatTmozlXVNemztn9c"",
"date": "Wed, 03 Jun 2026 19:00:28 GMT",
"connection": "keep-alive",
"keep-alive": "timeout=5"
},
"body": {
"statusCode": 500,
"timestamp": "2026-06-03T19:00:28.607Z",
"exception": {
"message": "2 UNKNOWN: failed to refresh media connections: failed to query media connections: websocket not connected",
"code": 2,
"details": "failed to refresh media connections: failed to query media connections: websocket not connected",
"metadata": {},
"name": "Error",
"stack": "Error: 2 UNKNOWN: failed to refresh media connections: failed to query media connections: websocket not connected\n at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/build/src/call.js:32:19)\n at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client.js:193:76)\n at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:367:141)\n at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:327:181)\n at /app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:135:78\n at process.processTicksAndRejections (node:internal/process/task_queues:84:11)\nfor call at\n at MessageServiceClient.makeUnaryRequest (/app/node_modules/@grpc/grpc-js/build/src/client.js:161:32)\n at MessageServiceClient.SendMessage (/app/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)\n at MessageServiceClient.SendMessage (/app/dist/core/engines/gows/grpc/gows.js:10542:30)\n at node:internal/util:495:21\n at new Promise (