From 6c1d7aaaf3beed4d6a56fc5c810976e74f95ef13 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 8 Oct 2024 13:45:30 -0400 Subject: [PATCH] fixes function name resolution to cloud tasks emulator queue --- src/functions/functions-api-client-internal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/functions/functions-api-client-internal.ts b/src/functions/functions-api-client-internal.ts index 6696f18da3..e020a70921 100644 --- a/src/functions/functions-api-client-internal.ts +++ b/src/functions/functions-api-client-internal.ts @@ -92,7 +92,7 @@ export class FunctionsApiClient { } try { - const serviceUrl = tasksEmulatorUrl(resources, functionName)?.concat('/', id) + const serviceUrl = tasksEmulatorUrl(resources)?.concat('/', id) ?? await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT.concat('/', id)); const request: HttpRequestConfig = { method: 'DELETE', @@ -147,7 +147,7 @@ export class FunctionsApiClient { const task = this.validateTaskOptions(data, resources, opts); try { const serviceUrl = - tasksEmulatorUrl(resources, functionName) ?? + tasksEmulatorUrl(resources) ?? await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT); const taskPayload = await this.updateTaskPayload(task, resources, extensionId); @@ -436,9 +436,9 @@ export class FirebaseFunctionsError extends PrefixedFirebaseError { } } -function tasksEmulatorUrl(resources: utils.ParsedResource, functionName: string): string | undefined { +function tasksEmulatorUrl(resources: utils.ParsedResource): string | undefined { if (process.env.CLOUD_TASKS_EMULATOR_HOST) { - return `http://${process.env.CLOUD_TASKS_EMULATOR_HOST}/projects/${resources.projectId}/locations/${resources.locationId}/queues/${functionName}/tasks`; + return `http://${process.env.CLOUD_TASKS_EMULATOR_HOST}/projects/${resources.projectId}/locations/${resources.locationId}/queues/${resources.resourceId}/tasks`; } return undefined; }