Skip to content

fix(schematics): use the exported logger/compat subpath in generated functions - #3730

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/functions-logger-compat-path
Open

fix(schematics): use the exported logger/compat subpath in generated functions#3730
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:fix/functions-logger-compat-path

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

The SSR Cloud Function generated by ng deploy crashes 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

Cause

Both generated templates require firebase-functions/lib/logger/compat. firebase-functions declares an exports map, and that internal path is not in it. The exported subpath is firebase-functions/logger/compat, which resolves to the same file.

Verification

I generated the function source and loaded it against a real firebase-functions install. The shipped path throws the error above. The exported path loads and emits structured Cloud Logging JSON, which is what the compat logger is there to produce.

Scope

This affects the deployed function rather than the build, so it surfaces in Cloud Functions at cold start rather than during ng deploy. It is present in both the 20.x and 21.x lines, so it wants a backport to the next 20.x patch.

…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.
@armando-navarro armando-navarro added bump: patch comp: schematics ng add / deploy schematics (src/schematics). comp: ssr Server-side rendering, hydration, @angular/ssr interop. type: bug Defect: expected behavior doesn't happen. labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch comp: schematics ng add / deploy schematics (src/schematics). comp: ssr Server-side rendering, hydration, @angular/ssr interop. type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant