From 5be8f8d2ad47431511b99cb288dc42ea6e3c8b6a Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Tue, 21 Apr 2026 09:55:55 -0700 Subject: [PATCH 1/2] feat: ignore punycode deprecation warning on Node 22 ### Description Added a warning handler in the CLI entry point to ignore the `DEP0040` (punycode deprecation) warning. This warning is triggered by dependencies (like `tr46`) on Node 22 because Node 22 deprecates the built-in `punycode` module. Since we cannot easily update the dependencies to avoid it without risking regressions or security issues, ignoring the specific warning is the safest approach. Fixes #10385 ### Scenarios Tested - Verified that unit tests pass (4269 passing). - Verified that the changes are limited to `src/bin/firebase.ts` and `CHANGELOG.md`. ### Sample Commands None (this is an internal warning suppression). --- CHANGELOG.md | 1 + src/bin/firebase.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bef9a30b97..4bf88a6f9b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Suppressed the 'punycode' deprecation warning on Node 22 by ignoring the `DEP0040` code. - Fixed an issue where hosting deploy allowed publishing to a site in a different project. (#10376) - Added 'firebase_deploy' and 'firebase_deploy_status' MCP tools. - Added SSE mode support to `firebase mcp`. To use it, run `firebase mcp --mode=sse --port=3000`, and connect your client on `http://localhost:3000`. diff --git a/src/bin/firebase.ts b/src/bin/firebase.ts index 9e80b9748ac..5350a6d51a1 100755 --- a/src/bin/firebase.ts +++ b/src/bin/firebase.ts @@ -3,6 +3,24 @@ // Check for older versions of Node no longer supported by the CLI. import * as semver from "semver"; const pkg = require("../../package.json"); + +interface NodeWarning extends Error { + code?: string; +} + +// List of warning codes to silence +const IGNORED_WARNINGS = [ + "DEP0040", // Punycode module is deprecated. Ignored because transitive dependencies (e.g. tr46) still use it via require('punycode/') or directly. +]; + +process.on("warning", (warning) => { + const nodeWarning = warning as NodeWarning; + if (nodeWarning.code && IGNORED_WARNINGS.includes(nodeWarning.code)) { + return; + } + console.warn(nodeWarning.stack || nodeWarning.message); +}); + const nodeVersion = process.version; if (!semver.satisfies(nodeVersion, pkg.engines.node)) { console.error( From 7ee19a9b30b116f47cdb38660fbbde5af75bafd1 Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Tue, 21 Apr 2026 10:14:02 -0700 Subject: [PATCH 2/2] Better changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bf88a6f9b6..0f154723ece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -- Suppressed the 'punycode' deprecation warning on Node 22 by ignoring the `DEP0040` code. +- Suppressed the 'punycode' deprecation warning during `firebase deploy` on Node 22. (#10385) - Fixed an issue where hosting deploy allowed publishing to a site in a different project. (#10376) - Added 'firebase_deploy' and 'firebase_deploy_status' MCP tools. - Added SSE mode support to `firebase mcp`. To use it, run `firebase mcp --mode=sse --port=3000`, and connect your client on `http://localhost:3000`.