Skip to content

Commit 3b658b4

Browse files
authored
Silence punycode deprecation notice (#10395)
* 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). * Better changelog
1 parent 13c3a47 commit 3b658b4

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- Suppressed the 'punycode' deprecation warning during `firebase deploy` on Node 22. (#10385)
12
- Fixed an issue where hosting deploy allowed publishing to a site in a different project. (#10376)
23
- Added 'firebase_deploy' and 'firebase_deploy_status' MCP tools.
34
- 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`.

src/bin/firebase.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
// Check for older versions of Node no longer supported by the CLI.
44
import * as semver from "semver";
55
const pkg = require("../../package.json");
6+
7+
interface NodeWarning extends Error {
8+
code?: string;
9+
}
10+
11+
// List of warning codes to silence
12+
const IGNORED_WARNINGS = [
13+
"DEP0040", // Punycode module is deprecated. Ignored because transitive dependencies (e.g. tr46) still use it via require('punycode/') or directly.
14+
];
15+
16+
process.on("warning", (warning) => {
17+
const nodeWarning = warning as NodeWarning;
18+
if (nodeWarning.code && IGNORED_WARNINGS.includes(nodeWarning.code)) {
19+
return;
20+
}
21+
console.warn(nodeWarning.stack || nodeWarning.message);
22+
});
23+
624
const nodeVersion = process.version;
725
if (!semver.satisfies(nodeVersion, pkg.engines.node)) {
826
console.error(

0 commit comments

Comments
 (0)