Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/functions-config-clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { requirePermissions } from "../requirePermissions";
import * as functionsConfig from "../functionsConfig";
import { functionsConfigClone } from "../functionsConfigClone";
import * as utils from "../utils";
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";

export const command = new Command("functions:config:clone")
.description("clone environment config from another project")
.option("--from <projectId>", "the project from which to clone configuration")
.option("--only <keys>", "a comma-separated list of keys to clone")
.option("--except <keys>", "a comma-separated list of keys to not clone")
.before(functionsConfig.ensureLegacyRuntimeConfigCommandsEnabled)
.before(requirePermissions, [
"runtimeconfig.configs.list",
"runtimeconfig.configs.create",
Expand Down Expand Up @@ -57,5 +57,5 @@ export const command = new Command("functions:config:clone")
"firebase deploy --only functions",
)}\n`,
);
logFunctionsConfigDeprecationWarning();
functionsConfig.logFunctionsConfigDeprecationWarning();
});
3 changes: 1 addition & 2 deletions src/commands/functions-config-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { logger } from "../logger";
import { needProjectId } from "../projectUtils";
import { requirePermissions } from "../requirePermissions";
import * as functionsConfig from "../functionsConfig";
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";

async function materialize(projectId: string, path?: string): Promise<any> {
if (path === undefined) {
Expand All @@ -32,6 +31,6 @@ export const command = new Command("functions:config:get [path]")
.action(async (path, options) => {
const result = await materialize(needProjectId(options), path);
logger.info(JSON.stringify(result, null, 2));
logFunctionsConfigDeprecationWarning();
functionsConfig.logFunctionsConfigDeprecationWarning();
return result;
});
4 changes: 2 additions & 2 deletions src/commands/functions-config-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { needProjectId } from "../projectUtils";
import { requirePermissions } from "../requirePermissions";
import * as functionsConfig from "../functionsConfig";
import * as utils from "../utils";
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";

export const command = new Command("functions:config:set [values...]")
.description("set environment config with key=value syntax")
.before(functionsConfig.ensureLegacyRuntimeConfigCommandsEnabled)
.before(requirePermissions, [
"runtimeconfig.configs.list",
"runtimeconfig.configs.create",
Expand Down Expand Up @@ -50,5 +50,5 @@ export const command = new Command("functions:config:set [values...]")
"firebase deploy --only functions",
)}\n`,
);
logFunctionsConfigDeprecationWarning();
functionsConfig.logFunctionsConfigDeprecationWarning();
});
4 changes: 2 additions & 2 deletions src/commands/functions-config-unset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import * as functionsConfig from "../functionsConfig";
import * as runtimeconfig from "../gcp/runtimeconfig";
import * as utils from "../utils";
import { FirebaseError } from "../error";
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";

export const command = new Command("functions:config:unset [keys...]")
.description("unset environment config at the specified path(s)")
.before(functionsConfig.ensureLegacyRuntimeConfigCommandsEnabled)
.before(requirePermissions, [
"runtimeconfig.configs.list",
"runtimeconfig.configs.create",
Expand Down Expand Up @@ -45,5 +45,5 @@ export const command = new Command("functions:config:unset [keys...]")
"firebase deploy --only functions",
)}\n`,
);
logFunctionsConfigDeprecationWarning();
functionsConfig.logFunctionsConfigDeprecationWarning();
});
2 changes: 1 addition & 1 deletion src/commands/internaltesting-functions-discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const command = new Command("internaltesting:functions:discover")
}

let runtimeConfig: Record<string, unknown> = { firebase: firebaseConfig };
const allowFunctionsConfig = experiments.isEnabled("dangerouslyAllowFunctionsConfig");
const allowFunctionsConfig = experiments.isEnabled("legacyRuntimeConfigCommands");

if (allowFunctionsConfig) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/deploy/functions/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ 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");
const allowFunctionsConfig = experiments.isEnabled("legacyRuntimeConfigCommands");

// Load runtime config if experiment allows it and API is enabled
if (allowFunctionsConfig && checkAPIsEnabled[1]) {
Expand Down
3 changes: 1 addition & 2 deletions src/deploy/functions/prepareFunctionsUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import * as functionsConfig from "../../functionsConfig";
import * as utils from "../../utils";
import * as fsAsync from "../../fsAsync";
import * as projectConfig from "../../functions/projectConfig";
import { logFunctionsConfigDeprecationWarning } from "../../functions/deprecationWarnings";

const CONFIG_DEST_FILE = ".runtimeconfig.json";

Expand Down Expand Up @@ -104,7 +103,7 @@ async function packageSource(
// Only warn about deprecated runtime config if there are user-defined values
// (i.e., keys other than the default 'firebase' key)
if (Object.keys(runtimeConfig).some((k) => k !== "firebase")) {
logFunctionsConfigDeprecationWarning();
functionsConfig.logFunctionsConfigDeprecationWarning();
}
}
await pipeAsync(archive, fileStream);
Expand Down
12 changes: 6 additions & 6 deletions src/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const ALL_EXPERIMENTS = experiments({
"of deploys. This has been made an experiment due to backend bugs that are " +
"temporarily causing failures in some regions with this optimization enabled",
public: true,
default: true,
default: false,
},
deletegcfartifacts: {
shortDescription: `Add the ${bold(
Expand All @@ -55,13 +55,13 @@ export const ALL_EXPERIMENTS = experiments({
`Registry. The ${bold("functions:deletegcfartifacts")} command ` +
"will delete all Docker images created by Google Cloud Functions irrespective " +
"of how that image was created.",
public: true,
public: false,
},
dangerouslyAllowFunctionsConfig: {
shortDescription: "Allows the use of deprecated functions.config() API",
legacyRuntimeConfigCommands: {
shortDescription: "Expose legacy functions.config() CLI commands",
fullDescription:
"The functions.config() API is deprecated and will be removed on December 31, 2025. " +
"This experiment allows continued use of the API during the migration period.",
"The Cloud Runtime Config API is deprecated. Enable this experiment to continue using the " +
"`functions:config:*` commands while you migrate to the Firebase Functions params APIs.",
default: true,
public: true,
},
Expand Down
22 changes: 0 additions & 22 deletions src/functions/deprecationWarnings.ts

This file was deleted.

41 changes: 41 additions & 0 deletions src/functionsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,52 @@ import { FirebaseError } from "./error";
import { needProjectId } from "./projectUtils";
import * as runtimeconfig from "./gcp/runtimeconfig";
import * as args from "./deploy/functions/args";
import * as experiments from "./experiments";
import { logWarningToStderr } from "./utils";

export const RESERVED_NAMESPACES = ["firebase"];

const apiClient = new Client({ urlPrefix: firebaseApiOrigin() });

const LEGACY_RUNTIME_CONFIG_EXPERIMENT = "legacyRuntimeConfigCommands";

const FUNCTIONS_CONFIG_DEPRECATION_MESSAGE = `DEPRECATION NOTICE: Action required before March 2026

The functions.config() API and the Cloud Runtime Config service are deprecated. Deploys that rely on functions.config() will fail once Runtime Config shuts down in March 2026.

The legacy functions:config:* CLI commands are deprecated and will be removed before March 2026.

Learn how to migrate from functions.config() to the params package:

https://firebase.google.com/docs/functions/config-env#migrate-config

To convert existing functions.config() values to params, try the interactive migration command:

firebase functions:config:export
`;

const LEGACY_GUIDANCE_MESSAGE = `${FUNCTIONS_CONFIG_DEPRECATION_MESSAGE}

To run this legacy command temporarily, run the following command and try again:

firebase experiments:enable ${LEGACY_RUNTIME_CONFIG_EXPERIMENT}
`;

export function getFunctionsConfigDeprecationMessage(): string {
return FUNCTIONS_CONFIG_DEPRECATION_MESSAGE;
}

export function logFunctionsConfigDeprecationWarning(): void {
logWarningToStderr(FUNCTIONS_CONFIG_DEPRECATION_MESSAGE);
}

export function ensureLegacyRuntimeConfigCommandsEnabled(): void {
if (experiments.isEnabled(LEGACY_RUNTIME_CONFIG_EXPERIMENT)) {
return;
}
throw new FirebaseError(LEGACY_GUIDANCE_MESSAGE, { exit: 1 });
}

interface Id {
config: string;
variable: string;
Expand Down
Loading