-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add disallowLegacyRuntimeConfig property to skip Runtime Config API during function deploys. #9354
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
Changes from 13 commits
961239e
dfdd7c5
ef634fc
2242219
cb9ca43
ca7a847
a53dada
de9ab02
224673e
d7e68f0
ce85748
7f7cb25
6ce746f
2f3758e
8229b08
75f8cd3
de50d69
74280d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| - Add JSON format support for Cloud Functions secrets with `--format json` flag and auto-detection from file extensions (#1745) | ||
| - `firebase dataconnect:sdk:generate` will run `init dataconnect:sdk` automatically if no SDKs are configured (#9325). | ||
| - Tighten --only filter resolution for functions deployment to prefer codebase names (#9353) | ||
| - Add `disallowLegacyRuntimeConfig` option to `firebase.json` to optionally skip fetching legacy Runtime Config during function deploys (#9354) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ import * as runtimes from "./runtimes"; | |
| import * as supported from "./runtimes/supported"; | ||
| import * as validate from "./validate"; | ||
| import * as ensure from "./ensure"; | ||
| import * as experiments from "../../experiments"; | ||
| import { | ||
| functionsOrigin, | ||
| artifactRegistryDomain, | ||
|
|
@@ -43,6 +42,7 @@ import { | |
| normalizeAndValidate, | ||
| ValidatedConfig, | ||
| requireLocal, | ||
| shouldUseRuntimeConfig, | ||
| } from "../../functions/projectConfig"; | ||
| import { AUTH_BLOCKING_EVENTS } from "../../functions/events/v1"; | ||
| import { generateServiceIdentity } from "../../gcp/serviceusage"; | ||
|
|
@@ -94,10 +94,11 @@ export async function prepare( | |
|
|
||
| // ===Phase 1. Load codebases from source with optional runtime config. | ||
| let runtimeConfig: Record<string, unknown> = { firebase: firebaseConfig }; | ||
| const allowFunctionsConfig = experiments.isEnabled("dangerouslyAllowFunctionsConfig"); | ||
|
|
||
| // Load runtime config if experiment allows it and API is enabled | ||
| if (allowFunctionsConfig && checkAPIsEnabled[1]) { | ||
| const targetedCodebaseConfigs = context.config!.filter((cfg) => codebases.includes(cfg.codebase)); | ||
|
|
||
| // Load runtime config if API is enabled and at least one targeted codebase uses it | ||
| if (checkAPIsEnabled[1] && targetedCodebaseConfigs.some(shouldUseRuntimeConfig)) { | ||
| runtimeConfig = { ...runtimeConfig, ...(await getFunctionsConfig(projectId)) }; | ||
| } | ||
|
|
||
|
|
@@ -228,7 +229,8 @@ export async function prepare( | |
| source.functionsSourceV2Hash = packagedSource?.hash; | ||
| } | ||
| if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv1")) { | ||
| const packagedSource = await prepareFunctionsUpload(sourceDir, localCfg, runtimeConfig); | ||
| const configForUpload = shouldUseRuntimeConfig(localCfg) ? runtimeConfig : undefined; | ||
| const packagedSource = await prepareFunctionsUpload(sourceDir, localCfg, configForUpload); | ||
| source.functionsSourceV1 = packagedSource?.pathToSource; | ||
| source.functionsSourceV1Hash = packagedSource?.hash; | ||
| } | ||
|
|
@@ -486,7 +488,12 @@ export async function loadCodebases( | |
| "functions", | ||
| `Loading and analyzing source code for codebase ${codebase} to determine what to deploy`, | ||
| ); | ||
| const discoveredBuild = await runtimeDelegate.discoverBuild(runtimeConfig, { | ||
|
|
||
| const codebaseRuntimeConfig = shouldUseRuntimeConfig(codebaseConfig) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. worth logging here? maybe if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will functions.config() just silently fail if someone on v6 has runtime config turned off in their firebase.json but tries to use it in their functions code? the env var the firebase-functions SDK reads for functions.config will just be undefined, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it would be equivalent to functions.config() returning an empty object |
||
| ? runtimeConfig | ||
| : { firebase: firebaseConfig }; | ||
|
|
||
| const discoveredBuild = await runtimeDelegate.discoverBuild(codebaseRuntimeConfig, { | ||
| ...firebaseEnvs, | ||
| // Quota project is required when using GCP's Client-based APIs | ||
| // Some GCP client SDKs, like Vertex AI, requires appropriate quota project setup | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.