diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e5992190dd..04e2ebc4b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fix type mismatch for parametrized function region. (#6205) - Ignore `FIRESTORE_EMULATOR_HOST` environment variable on functions deploy. (#6442) - Added support for enabling, disabling, and displaying Point In Time Recovery enablement state on Firestore databases (#6388) - Added a `--verbosity` flag to `emulators:*` commands that limits what logs are printed (#2859) diff --git a/src/deploy/functions/build.ts b/src/deploy/functions/build.ts index 47dd2c07a6b..e19de9bdadd 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);