Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type mismatch for parametrized function region #6205

Merged
merged 8 commits into from
Oct 11, 2023
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
16 changes: 15 additions & 1 deletion src/deploy/functions/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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 {
Expand Down Expand Up @@ -434,8 +435,21 @@
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) {

Check warning on line 446 in src/deploy/functions/build.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type
if (err instanceof ExprParseError) {
regions = [params.resolveString(bdEndpoint.region, paramValues)];
} else {
throw err;
}
}
}
for (const region of regions) {
const trigger = discoverTrigger(bdEndpoint, region, r);
Expand Down
Loading