From 22f25a460350c2552b4d0d484b3a2c61c7d9a05a Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 1 Aug 2023 14:15:44 -0400 Subject: [PATCH 1/2] fix type mismatch for region param --- src/deploy/functions/build.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/deploy/functions/build.ts b/src/deploy/functions/build.ts index 846a49043b3..f230950c3b9 100644 --- a/src/deploy/functions/build.ts +++ b/src/deploy/functions/build.ts @@ -7,6 +7,7 @@ import { assertExhaustive, mapObject, nullsafeVisitor } from "../../functional"; import { UserEnvsOpts, writeUserEnvs } from "../../functions/env"; import { FirebaseConfig } from "./args"; import { Runtime } from "./runtimes"; +import { ExprParseError } from "./cel"; /* The union of a customer-controlled deployment and potentially deploy-time defined parameters */ export interface Build { @@ -434,8 +435,21 @@ export function toBackend( let regions: string[] = []; if (!bdEndpoint.region) { regions = [api.functionsDefaultRegion]; - } else { + } else if (Array.isArray(bdEndpoint.region)) { regions = params.resolveList(bdEndpoint.region, paramValues); + } else { + // N.B. setting region via GlobalOptions only accepts a String param. + // Therefore if we raise an exception by attempting to resolve a + // List param, we try resolving a String param instead. + try { + regions = params.resolveList(bdEndpoint.region, paramValues); + } catch (err: any) { + if (err instanceof ExprParseError) { + regions = [params.resolveString(bdEndpoint.region, paramValues)]; + } else { + throw err; + } + } } for (const region of regions) { const trigger = discoverTrigger(bdEndpoint, region, r); From 001902eb54d4b07e2b54bbaaca1d08fa624a26e8 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 1 Aug 2023 14:21:10 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97f71788079..bdb53b2988b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ +- Fix type mismatch for parametrized function region. (#6205) - Fix bug where functions:secrets:\* family of commands did not work when Firebase CLI is authenticated via GOOGLE_APPLICATION_CREDENTIALS (#6190)