Skip to content

fix(schematics): only emit FirebaseOptions keys in the generated app config#3707

Merged
armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:fix/schematic-firebase-options-allowlist
Jul 10, 2026
Merged

fix(schematics): only emit FirebaseOptions keys in the generated app config#3707
armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:fix/schematic-firebase-options-allowlist

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

ng add @angular/fire inlines the Firebase CLI's apps.sdkconfig response into initializeApp(). That response includes management-API fields (projectNumber, version, locationId) that FirebaseOptions does not accept; only locationId was being stripped (added for #3452 / #3556), so the generated app fails to compile with TS2769: 'projectNumber' does not exist in type 'FirebaseOptions'. This is the third report of the class.

This replaces the single-key delete with an allowlist of the keys initializeApp() accepts, so future additions to the CLI response can't break the generated config.

Companion PR #3706 declares the ES2022 lib the Object.fromEntries here relies on (IDE-only; not required for CI).

Fixes #3675

…config

The Firebase CLI's apps.sdkconfig response includes management-API
fields (projectNumber, version, locationId) alongside the web app
config. The schematic only deleted locationId and inlined the rest
into initializeApp(), so the generated app failed to compile with
TS2769: 'projectNumber' does not exist in type 'FirebaseOptions'.

Keep only the keys FirebaseOptions accepts, so future additions to
the CLI response cannot break the generated config again.
@armando-navarro
armando-navarro merged commit 9a2a541 into angular:main Jul 10, 2026
24 checks passed
@armando-navarro armando-navarro added bump: patch comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen. labels Jul 25, 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). type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng add @angular/fire <- Generates the config that does not compile

2 participants