diff --git a/sdk/eventhub/event-hubs/src/eventHubSender.ts b/sdk/eventhub/event-hubs/src/eventHubSender.ts index b149d68e4334..ccde32d6e311 100644 --- a/sdk/eventhub/event-hubs/src/eventHubSender.ts +++ b/sdk/eventhub/event-hubs/src/eventHubSender.ts @@ -644,7 +644,7 @@ export class EventHubSender extends LinkEntity { ); return resolve(); } catch (err) { - err = translate(err); + err = translate(err.innerError || err); log.error( "[%s] An error occurred while sending the message", this._context.connectionId, diff --git a/sdk/eventhub/event-hubs/test/sender.spec.ts b/sdk/eventhub/event-hubs/test/sender.spec.ts index 1bc1c72a9530..382970365a1c 100644 --- a/sdk/eventhub/event-hubs/test/sender.spec.ts +++ b/sdk/eventhub/event-hubs/test/sender.spec.ts @@ -355,6 +355,24 @@ describe("EventHub Sender #RunnableInBrowser", function(): void { } await Promise.all(promises); }); + + it("should be sent successfully in parallel, even when exceeding max event listener count of 1000", async function(): Promise< + void + > { + const senderCount = 1200; + try { + const producer = client.createProducer(); + const promises = []; + for (let i = 0; i < senderCount; i++) { + promises.push(producer.send([{ body: `Hello World ${i}` }])); + } + await Promise.all(promises); + } catch (err) { + debug("An error occurred while running the test: ", err); + throw err; + } + }); + it("should be sent successfully in parallel by multiple senders", async function(): Promise< void > {