From 81748ca8048abb3e29038620262a52c405c74a1b Mon Sep 17 00:00:00 2001 From: Antoine Arlaud Date: Wed, 28 Feb 2024 17:50:49 +0100 Subject: [PATCH] fix: avoid crashed on econnresets --- lib/common/http/downstream-post-stream-to-server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/common/http/downstream-post-stream-to-server.ts b/lib/common/http/downstream-post-stream-to-server.ts index 40d4651a1..5159946c6 100644 --- a/lib/common/http/downstream-post-stream-to-server.ts +++ b/lib/common/http/downstream-post-stream-to-server.ts @@ -97,7 +97,7 @@ class BrokerServerPostResponseHandler { }, 'received error sending data via POST to Broker Server', ); - this.#buffer.end(e); + this.#buffer.end(e.message); }) .on('response', (r) => { r.on('error', (err) => { @@ -171,7 +171,7 @@ class BrokerServerPostResponseHandler { // If we *don't* have a buffer object, then there was a major failure with the request (e.g., host not found), so // we will forward that directly to the Broker Server if (this.#buffer) { - this.#buffer.end(error); + this.#buffer.end(error.message); } else { const body = JSON.stringify({ error: error }); this.#sendIoData(