diff --git a/src/eventarc/eventarc-client-internal.ts b/src/eventarc/eventarc-client-internal.ts index e265480024..ce02967c93 100644 --- a/src/eventarc/eventarc-client-internal.ts +++ b/src/eventarc/eventarc-client-internal.ts @@ -102,7 +102,7 @@ export class EventarcApiClient { } const request: HttpRequestConfig = { method: 'POST', - url: `${EVENTARC_API}/${channel}:publishEvents`, + url: `${this.getEventarcHost()}/${channel}:publishEvents`, data: JSON.stringify({ events }), }; return this.sendRequest(request); @@ -153,4 +153,8 @@ export class EventarcApiClient { const projectId = await this.getProjectId(); return `projects/${projectId}/locations/${location}/channels/${channelId}`; } + + private getEventarcHost(): string { + return process.env.CLOUD_EVENTARC_EMULATOR_HOST ?? EVENTARC_API; + } }