diff --git a/src/deploy/functions/backend.spec.ts b/src/deploy/functions/backend.spec.ts index 522505b9cc3..b383344b6a7 100644 --- a/src/deploy/functions/backend.spec.ts +++ b/src/deploy/functions/backend.spec.ts @@ -52,15 +52,16 @@ describe("Backend", () => { maxInstanceRequestConcurrency: 80, }, }; - const RUN_URI = "https://id-nonce-region-project.run.app"; + const GCF_URL = "https://region-project.cloudfunctions.net/id"; const HAVE_CLOUD_FUNCTION_V2: gcfV2.OutputCloudFunction = { ...CLOUD_FUNCTION_V2, serviceConfig: { service: "service", - uri: RUN_URI, + uri: GCF_URL, availableCpu: "1", maxInstanceRequestConcurrency: 80, }, + url: GCF_URL, state: "ACTIVE", updateTime: new Date(), }; diff --git a/src/deploy/functions/release/fabricator.ts b/src/deploy/functions/release/fabricator.ts index b755897285b..cf97308b4a4 100644 --- a/src/deploy/functions/release/fabricator.ts +++ b/src/deploy/functions/release/fabricator.ts @@ -394,7 +394,7 @@ export class Fabricator { }); } - endpoint.uri = resultFunction.serviceConfig?.uri; + endpoint.uri = resultFunction.url; const serviceName = resultFunction.serviceConfig?.service; endpoint.runServiceId = utils.last(serviceName?.split("/")); if (!serviceName) { diff --git a/src/gcp/cloudfunctionsv2.spec.ts b/src/gcp/cloudfunctionsv2.spec.ts index ffe68467fff..4d3b89eab35 100644 --- a/src/gcp/cloudfunctionsv2.spec.ts +++ b/src/gcp/cloudfunctionsv2.spec.ts @@ -49,12 +49,14 @@ describe("cloudfunctionsv2", () => { }; const RUN_URI = "https://id-nonce-region-project.run.app"; + const GCF_URL = "https://region-project.cloudfunctions.net/id"; const HAVE_CLOUD_FUNCTION_V2: cloudfunctionsv2.OutputCloudFunction = { ...CLOUD_FUNCTION_V2, serviceConfig: { service: "service", uri: RUN_URI, }, + url: GCF_URL, state: "ACTIVE", updateTime: new Date(), }; @@ -408,7 +410,7 @@ describe("cloudfunctionsv2", () => { ...ENDPOINT, httpsTrigger: {}, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, }); }); @@ -425,7 +427,7 @@ describe("cloudfunctionsv2", () => { ...ENDPOINT, httpsTrigger: {}, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, runServiceId: "service-id", }); }); @@ -434,7 +436,7 @@ describe("cloudfunctionsv2", () => { let want: backend.Endpoint = { ...ENDPOINT, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, eventTrigger: { eventType: events.v2.PUBSUB_PUBLISH_EVENT, eventFilters: { topic: "projects/p/topics/t" }, @@ -561,7 +563,7 @@ describe("cloudfunctionsv2", () => { const want: backend.Endpoint = { ...ENDPOINT, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, eventTrigger: { eventType: "com.custom.event", eventFilters: { customattr: "customvalue" }, @@ -596,7 +598,7 @@ describe("cloudfunctionsv2", () => { ...ENDPOINT, taskQueueTrigger: {}, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, labels: { "deployment-taskqueue": "true" }, }); }); @@ -613,7 +615,7 @@ describe("cloudfunctionsv2", () => { eventType: events.v1.BEFORE_CREATE_EVENT, }, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, labels: { "deployment-blocking": "before-create" }, }); }); @@ -630,7 +632,7 @@ describe("cloudfunctionsv2", () => { eventType: events.v1.BEFORE_SIGN_IN_EVENT, }, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, labels: { "deployment-blocking": "before-sign-in" }, }); }); @@ -668,7 +670,7 @@ describe("cloudfunctionsv2", () => { ...ENDPOINT, platform: "gcfv2", httpsTrigger: {}, - uri: RUN_URI, + uri: GCF_URL, ...extraFields, serviceAccount: "inlined@google.com", vpc, @@ -703,7 +705,7 @@ describe("cloudfunctionsv2", () => { ).to.deep.equal({ ...ENDPOINT, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, httpsTrigger: {}, ...extraFields, }); @@ -721,7 +723,7 @@ describe("cloudfunctionsv2", () => { ).to.deep.equal({ ...ENDPOINT, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, httpsTrigger: {}, labels: { ...ENDPOINT.labels, @@ -744,7 +746,7 @@ describe("cloudfunctionsv2", () => { ).to.deep.equal({ ...ENDPOINT, platform: "gcfv2", - uri: RUN_URI, + uri: GCF_URL, httpsTrigger: {}, labels: { ...ENDPOINT.labels, @@ -761,6 +763,7 @@ describe("cloudfunctionsv2", () => { ...ENDPOINT, platform: "gcfv2", httpsTrigger: {}, + uri: GCF_URL, }; delete expectedEndpoint.runServiceId; expect( diff --git a/src/gcp/cloudfunctionsv2.ts b/src/gcp/cloudfunctionsv2.ts index 82f14bce6fb..af1cb92984a 100644 --- a/src/gcp/cloudfunctionsv2.ts +++ b/src/gcp/cloudfunctionsv2.ts @@ -166,6 +166,7 @@ export type OutputCloudFunction = CloudFunctionBase & { state: FunctionState; updateTime: Date; serviceConfig?: RequireKeys; + url: string; }; export type InputCloudFunction = CloudFunctionBase & { @@ -781,6 +782,7 @@ export function endpointFromFunction(gcfFunction: OutputCloudFunction): backend. endpoint.runServiceId = utils.last(serviceName.split("/")); } } + proto.renameIfPresent(endpoint, gcfFunction, "uri", "url"); endpoint.codebase = gcfFunction.labels?.[CODEBASE_LABEL] || projectConfig.DEFAULT_CODEBASE; if (gcfFunction.labels?.[HASH_LABEL]) { endpoint.hash = gcfFunction.labels[HASH_LABEL];