From 341a6e0efd9452450e0f8d17281bd76bc47ee4bb Mon Sep 17 00:00:00 2001 From: Thomas Bouldin Date: Wed, 22 Jan 2025 09:40:30 -0800 Subject: [PATCH] Remove label annotations for genkit functions; they break (#8127) --- src/deploy/functions/backend.ts | 3 +++ src/gcp/cloudfunctionsv2.spec.ts | 40 -------------------------------- src/gcp/cloudfunctionsv2.ts | 6 ----- 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/src/deploy/functions/backend.ts b/src/deploy/functions/backend.ts index 113d1ac09dd..fcea6d149a4 100644 --- a/src/deploy/functions/backend.ts +++ b/src/deploy/functions/backend.ts @@ -42,6 +42,9 @@ export interface HttpsTriggered { /** API agnostic version of a Firebase callable function. */ export type CallableTrigger = { + // NOTE: This is currently unused because GCF 2nd gen labels do not support + // the characterset that may be in a genkit action name. + // This should be set as a Cloud Run attribute once we move to Cloud Run Functions. genkitAction?: string; }; diff --git a/src/gcp/cloudfunctionsv2.spec.ts b/src/gcp/cloudfunctionsv2.spec.ts index ef9486f9b9f..4d3b89eab35 100644 --- a/src/gcp/cloudfunctionsv2.spec.ts +++ b/src/gcp/cloudfunctionsv2.spec.ts @@ -221,23 +221,6 @@ describe("cloudfunctionsv2", () => { [BLOCKING_LABEL]: "before-sign-in", }, }); - - expect( - cloudfunctionsv2.functionFromEndpoint({ - ...ENDPOINT, - platform: "gcfv2", - callableTrigger: { - genkitAction: "flows/flow", - }, - }), - ).to.deep.equal({ - ...CLOUD_FUNCTION_V2, - labels: { - ...CLOUD_FUNCTION_V2.labels, - "deployment-callable": "true", - "genkit-action": "flows/flow", - }, - }); }); it("should copy trival fields", () => { @@ -654,29 +637,6 @@ describe("cloudfunctionsv2", () => { }); }); - it("should translate genkit callables", () => { - expect( - cloudfunctionsv2.endpointFromFunction({ - ...HAVE_CLOUD_FUNCTION_V2, - labels: { - "deployment-callable": "true", - "genkit-action": "flows/flow", - }, - }), - ).to.deep.equal({ - ...ENDPOINT, - callableTrigger: { - genkitAction: "flows/flow", - }, - platform: "gcfv2", - uri: GCF_URL, - labels: { - "deployment-callable": "true", - "genkit-action": "flows/flow", - }, - }); - }); - it("should copy optional fields", () => { const extraFields: backend.ServiceConfiguration = { ingressSettings: "ALLOW_ALL", diff --git a/src/gcp/cloudfunctionsv2.ts b/src/gcp/cloudfunctionsv2.ts index 6d17c607bbc..af1cb92984a 100644 --- a/src/gcp/cloudfunctionsv2.ts +++ b/src/gcp/cloudfunctionsv2.ts @@ -609,9 +609,6 @@ export function functionFromEndpoint(endpoint: backend.Endpoint): InputCloudFunc gcfFunction.labels = { ...gcfFunction.labels, "deployment-taskqueue": "true" }; } else if (backend.isCallableTriggered(endpoint)) { gcfFunction.labels = { ...gcfFunction.labels, "deployment-callable": "true" }; - if (endpoint.callableTrigger.genkitAction) { - gcfFunction.labels["genkit-action"] = endpoint.callableTrigger.genkitAction; - } } else if (backend.isBlockingTriggered(endpoint)) { gcfFunction.labels = { ...gcfFunction.labels, @@ -657,9 +654,6 @@ export function endpointFromFunction(gcfFunction: OutputCloudFunction): backend. trigger = { callableTrigger: {}, }; - if (gcfFunction.labels["genkit-action"]) { - trigger.callableTrigger.genkitAction = gcfFunction.labels["genkit-action"]; - } } else if (gcfFunction.labels?.[BLOCKING_LABEL]) { trigger = { blockingTrigger: {