Skip to content

fix(ai): drop the getImagenModel wrapper, removed in firebase 12.18 - #3750

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:a37-firebase-surface
Open

fix(ai): drop the getImagenModel wrapper, removed in firebase 12.18#3750
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:a37-firebase-surface

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Checklist

Description

Fixes #3749.

Firebase shut the Imagen models down in August 2026 and removed the Imagen API in @firebase/ai 2.15.0, which ships in firebase 12.18.0. The ai entry point imports getImagenModel, so any app whose install resolves firebase 12.18.0 fails to build.

The fix

  • The generator excludes getImagenModel from the wrapped named imports (a null override in tools/build.ts).
  • Installs whose firebase still includes the symbol (12.17 and older) keep compiling, because the entry point re-exports everything from firebase/ai with export *. That is compile-time grace only: the models are shut down, so the calls fail at the service on any firebase version.
  • The package deliberately keeps building against firebase 12.4.0, the lowest version the published ^12.4.0 range allows. That way every symbol the generated file imports by name exists in every firebase version a user's install can resolve.

Verification

  • A sweep of every wrapped @firebase package between the 12.4.0-mapped and 12.18.0-mapped versions confirmed getImagenModel is the only export removed in that window.
  • A typecheck of all generated named imports against a real firebase 12.18.0 install passes with this change and fails without it.
  • 227 specs, 0 failures.

Also in this change

  • The ng update Vertex AI migration treats getImagenModel as a removed symbol, leaving the import in place and logging guidance to move image generation to the Gemini image models through getGenerativeModel, with a new spec covering it.
  • The upgrade guide documents the removal, and its migration section is restructured into labeled cases and subheadings.
  • docs/ai.md no longer advertises Imagen models.

Firebase shut the Imagen models down in August 2026 and @firebase/ai
2.15.0 (firebase 12.18.0) removed the API. Our ai entry point
named-imports getImagenModel, so any install resolving firebase
12.18.0, which ^12.4.0 does on every fresh install, fails to build.

The generator now excludes getImagenModel from the wrapped named
imports. Installs whose firebase still includes the symbol (12.17
and older) keep compiling, because the entry point re-exports
everything from firebase/ai with export *. That is compile-time
grace only: the models are shut down, so the calls fail at the
service on any firebase version. The package keeps building against
firebase 12.4.0, the lowest version the published ^12.4.0 range
allows, so every symbol the generated file imports by name exists in
every firebase version a user's install can resolve: a sweep of every
wrapped @firebase package between the 12.4.0- and 12.18.0-mapped
versions found getImagenModel to be the only removed export.

The ng update migration now warns on getImagenModel imports with
guidance to move image generation to the Gemini image models via
getGenerativeModel, with a spec. The upgrade guide documents the
removal and its migration section is restructured for readability.
@armando-navarro armando-navarro added bump: patch comp: ai Firebase AI Logic / Vertex AI (src/ai). comp: docs Documentation. comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen. labels Aug 21, 2026

@tyler-reitz tyler-reitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified independently: the named imports of all 14 generated firebase.ts files typecheck against a real firebase 12.18.0 install, and re-adding getImagenModel reproduces the TS2305 from #3749; regenerating every entry point with this branch's tools/build.ts produces zero drift against the committed files; the new migration spec goes red with the tables.ts entry removed; and the published rc tarball keeps export * from 'firebase/ai' verbatim in the shipped .d.ts and fesm, so the fix carries through to the artifact users install.

One note, not a change request: on firebase 12.17 and older, getImagenModel is still reachable through the star export but now unwrapped, where the zone-wrapped named export used to shadow it (ran both shapes to confirm the precedence). Since every call fails at the shut-down service, the only effect is the rejection settling outside the Angular zone, consistent with the compile-time-grace framing in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch comp: ai Firebase AI Logic / Vertex AI (src/ai). comp: docs Documentation. 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.

@angular/fire/ai fails to build against firebase 12.18, which removed getImagenModel

2 participants