From 7677de4a13505b9830c58001402d7e88dd119274 Mon Sep 17 00:00:00 2001 From: Armando Navarro Date: Mon, 3 Aug 2026 15:06:49 -0700 Subject: [PATCH] fix(schematics): use the exported logger/compat subpath in generated functions The SSR Cloud Function generated by `ng deploy` crashed at cold start: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/logger/compat' is not defined by "exports" in node_modules/firebase-functions/package.json Both generated templates required `firebase-functions/lib/logger/compat`. firebase-functions declares an exports map, and the internal `lib/` path is not in it. The exported subpath is `firebase-functions/logger/compat`, which maps to the same file. Verified by generating the function source and loading it against a real firebase-functions install: the shipped path throws, the exported path loads and emits structured Cloud Logging JSON, which is what the compat logger is there to do. This affects the deployed function rather than the build, so it fails at runtime in Cloud Functions rather than during `ng deploy`, and it is present in both the 20.x and 21.x lines. --- src/schematics/deploy/functions-templates.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schematics/deploy/functions-templates.ts b/src/schematics/deploy/functions-templates.ts index 4005675c9..13cd9ab14 100644 --- a/src/schematics/deploy/functions-templates.ts +++ b/src/schematics/deploy/functions-templates.ts @@ -37,7 +37,7 @@ export const defaultFunction = ( ) => `const functions = require('firebase-functions'); // Increase readability in Cloud Logging -require("firebase-functions/lib/logger/compat"); +require("firebase-functions/logger/compat"); const expressApp = require('./${path}/main').app(); @@ -55,7 +55,7 @@ export const functionGen2 = ( ) => `const { onRequest } = require('firebase-functions/v2/https'); // Increase readability in Cloud Logging -require("firebase-functions/lib/logger/compat"); +require("firebase-functions/logger/compat"); const expressApp = require('./${path}/main').app();