diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index f00597bab..e02225218 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -201,6 +201,8 @@ export function onCustomEventPublished( func.run = handler; const channel = opts.channel ?? "locations/us-central1/channels/firebase"; + const channelRegionMatch = channel.match(/locations\/([^/]+)\/channels\//); + const triggerRegion = channelRegionMatch ? channelRegionMatch[1] : "us-central1"; const baseOpts = options.optionsToEndpoint(options.getGlobalOptions()); const specificOpts = options.optionsToEndpoint(opts); @@ -219,6 +221,7 @@ export function onCustomEventPublished( eventFilters: {}, retry: opts.retry ?? false, channel, + region: triggerRegion, }, }; convertIfPresent(endpoint.eventTrigger, opts, "eventFilters", "filters");