Skip to content

Commit 8713fbd

Browse files
authored
Add deprecation warnings for functions.config() API (#8808)
## Summary Add deprecation warnings for functions.config() API ahead of Cloud Runtime Configuration API shutdown on Dec 31, 2025. ## Changes - Add `dangerouslyAllowFunctionsConfig` experiment (defaults to true) - Show deprecation warning on all `functions:config:*` commands - Show deprecation warning during deploy when runtime config is packaged - Warning includes migration deadline and documentation link
1 parent a6188c3 commit 8713fbd

File tree

9 files changed

+51
-0
lines changed

9 files changed

+51
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
- Added a deprecation warning for functions.config() to stderr on deploy and all functions:config commands. (#8808)
12
- Added analytics to track runtime config usage in functions deployments (#8870).
23
- Fixed issue where `__name__` fields with DESCENDING order were incorrectly filtered from index listings, causing duplicate index issues (#7629) and deployment conflicts (#8859). The fix now preserves `__name__` fields with explicit DESCENDING order while filtering out implicit ASCENDING `__name__` fields.

src/commands/functions-config-clone.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { requirePermissions } from "../requirePermissions";
88
import * as functionsConfig from "../functionsConfig";
99
import { functionsConfigClone } from "../functionsConfigClone";
1010
import * as utils from "../utils";
11+
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";
1112

1213
export const command = new Command("functions:config:clone")
1314
.description("clone environment config from another project")
@@ -56,4 +57,5 @@ export const command = new Command("functions:config:clone")
5657
"firebase deploy --only functions",
5758
)}\n`,
5859
);
60+
logFunctionsConfigDeprecationWarning();
5961
});

src/commands/functions-config-get.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { logger } from "../logger";
66
import { needProjectId } from "../projectUtils";
77
import { requirePermissions } from "../requirePermissions";
88
import * as functionsConfig from "../functionsConfig";
9+
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";
910

1011
async function materialize(projectId: string, path?: string): Promise<any> {
1112
if (path === undefined) {
@@ -31,5 +32,6 @@ export const command = new Command("functions:config:get [path]")
3132
.action(async (path, options) => {
3233
const result = await materialize(needProjectId(options), path);
3334
logger.info(JSON.stringify(result, null, 2));
35+
logFunctionsConfigDeprecationWarning();
3436
return result;
3537
});

src/commands/functions-config-set.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { needProjectId } from "../projectUtils";
77
import { requirePermissions } from "../requirePermissions";
88
import * as functionsConfig from "../functionsConfig";
99
import * as utils from "../utils";
10+
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";
1011

1112
export const command = new Command("functions:config:set [values...]")
1213
.description("set environment config with key=value syntax")
@@ -49,4 +50,5 @@ export const command = new Command("functions:config:set [values...]")
4950
"firebase deploy --only functions",
5051
)}\n`,
5152
);
53+
logFunctionsConfigDeprecationWarning();
5254
});

src/commands/functions-config-unset.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as functionsConfig from "../functionsConfig";
88
import * as runtimeconfig from "../gcp/runtimeconfig";
99
import * as utils from "../utils";
1010
import { FirebaseError } from "../error";
11+
import { logFunctionsConfigDeprecationWarning } from "../functions/deprecationWarnings";
1112

1213
export const command = new Command("functions:config:unset [keys...]")
1314
.description("unset environment config at the specified path(s)")
@@ -44,4 +45,5 @@ export const command = new Command("functions:config:unset [keys...]")
4445
"firebase deploy --only functions",
4546
)}\n`,
4647
);
48+
logFunctionsConfigDeprecationWarning();
4749
});

src/deploy/functions/prepareFunctionsUpload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as functionsConfig from "../../functionsConfig";
1313
import * as utils from "../../utils";
1414
import * as fsAsync from "../../fsAsync";
1515
import * as projectConfig from "../../functions/projectConfig";
16+
import { logFunctionsConfigDeprecationWarning } from "../../functions/deprecationWarnings";
1617

1718
const CONFIG_DEST_FILE = ".runtimeconfig.json";
1819

@@ -99,6 +100,9 @@ async function packageSource(
99100
name: CONFIG_DEST_FILE,
100101
mode: 420 /* 0o644 */,
101102
});
103+
104+
// Log deprecation warning when runtime config is being packaged
105+
logFunctionsConfigDeprecationWarning();
102106
}
103107
await pipeAsync(archive, fileStream);
104108
} catch (err: any) {

src/experiments.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ export const ALL_EXPERIMENTS = experiments({
5757
"of how that image was created.",
5858
public: true,
5959
},
60+
dangerouslyAllowFunctionsConfig: {
61+
shortDescription: "Allows the use of deprecated functions.config() API",
62+
fullDescription:
63+
"The functions.config() API is deprecated and will be removed on December 31, 2025. " +
64+
"This experiment allows continued use of the API during the migration period.",
65+
default: true,
66+
public: true,
67+
},
6068

6169
// Emulator experiments
6270
emulatoruisnapshot: {

src/functions/deprecationWarnings.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { logWarningToStderr } from "../utils";
2+
3+
const FUNCTIONS_CONFIG_DEPRECATION_MESSAGE = `DEPRECATION NOTICE: Action required to deploy after Dec 31, 2025
4+
5+
functions.config() API is deprecated.
6+
Cloud Runtime Configuration API, the Google Cloud service used to store function configuration data, will be shut down on December 31, 2025. As a result, you must migrate away from using functions.config() to continue deploying your functions after December 31, 2025.
7+
8+
What this means for you:
9+
10+
- The Firebase CLI commands for managing this configuration (functions:config:set, get, unset, clone, and export) are deprecated. These commands no longer work after December 31, 2025.
11+
- firebase deploy command will fail for functions that use the legacy functions.config() API after December 31, 2025.
12+
13+
Existing deployments will continue to work with their current configuration.
14+
15+
See your migration options at: https://firebase.google.com/docs/functions/config-env#migrate-to-dotenv`;
16+
17+
/**
18+
* Logs a deprecation warning for functions.config() usage
19+
*/
20+
export function logFunctionsConfigDeprecationWarning(): void {
21+
logWarningToStderr(FUNCTIONS_CONFIG_DEPRECATION_MESSAGE);
22+
}

src/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ export function logWarning(
198198
logger[type](clc.yellow(clc.bold(`${WARNING_CHAR} `)), message, data);
199199
}
200200

201+
/**
202+
* Log a warning statement to stderr, regardless of logger configuration.
203+
*/
204+
export function logWarningToStderr(message: string): void {
205+
const prefix = clc.bold(`${WARNING_CHAR} `);
206+
process.stderr.write(clc.yellow(prefix + message) + "\n");
207+
}
208+
201209
/**
202210
* Log an info statement with a gray bullet at the start of the line.
203211
*/

0 commit comments

Comments
 (0)