Skip to content

Commit af3834e

Browse files
authored
[EventHubs] fix sample issue when running in build pipeline (Azure#20385)
The value provided to EVENTHUB_CONNECTION_STRING in the live test pipeline doesn't contain the event hub name so it's failing with error: TypeError: Either provide "eventHubName" or the "connectionString": "***", must contain "EntityPath=<your-event-hub-name>". This PR passes event hub name too to the client constructor in the same way as some other tests do.
1 parent 492ca89 commit af3834e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sdk/eventhub/event-hubs/samples-dev/sendBufferedEvents.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import * as dotenv from "dotenv";
1616
dotenv.config();
1717

1818
const connectionString = process.env["EVENTHUB_CONNECTION_STRING"] || "";
19+
const eventHubName = process.env["EVENTHUB_NAME"] || "";
1920

2021
async function handleError(ctx: OnSendEventsErrorContext): Promise<void> {
2122
console.log(`The following error occurred:`);
@@ -36,7 +37,7 @@ export async function main(): Promise<void> {
3637
* Create a buffered client that batches the enqueued events and sends it either
3738
* after 750ms or after batching 1000 events, whichever occurs first.
3839
*/
39-
const client = new EventHubBufferedProducerClient(connectionString, {
40+
const client = new EventHubBufferedProducerClient(connectionString, eventHubName, {
4041
/** An error handler must be provided */
4142
onSendEventsErrorHandler: handleError,
4243

0 commit comments

Comments
 (0)