Skip to content

ng update rewrites Vertex AI calls to a deprecated backend class, in a location where current models are not served #3758

Description

@armando-navarro

Summary

The v21 migration rewrites an AngularFire 20 app's getVertexAI(...) calls to
getAI(app, { backend: new VertexAIBackend() }). Two things are wrong with the class it picks.

VertexAIBackend is marked @deprecated - Use AgentPlatformBackend instead in the Firebase SDK.
AgentPlatformBackend does not appear anywhere in src/ or docs/, so the deprecation is unaddressed
across the whole package, not only in the migration.

The larger problem is where that class sends requests. new VertexAIBackend() with no argument resolves
to us-central1, and new AgentPlatformBackend() resolves to global, which is the location Firebase
suggests when a model supports it and the only location that serves the Gemini 3.x models.

What a developer sees

An AngularFire 20 app calling getVertexAI(app) runs ng update, changes nothing else, and lands on a
deprecated class in a location where a current model returns a bare 404 with no explanation.

Measured against one live project, two calls a few minutes apart differing only in the backend class:

Backend Location Result for gemini-3.7-flash
new VertexAIBackend() us-central1 404, Publisher model ... was not found
new AgentPlatformBackend() global 200, model responded

The fix

Emit AgentPlatformBackend. A call that passed a location option would keep it, so only calls that
passed none, or a falsy one, would change location. That is a behavior change an automated rewrite
should not make quietly, so the migration should warn once for each file whose location moved, and
separately where a location is an expression that only runtime can resolve.

One case would need its own warning. Firebase does not serve the Live API models from global, so an
app calling getLiveGenerativeModel or startAudioConversation should not be left there. The
migration could look for either of those across the workspace and say so in the warning.

Dependency

AgentPlatformBackend first appears in @firebase/ai 2.14.0, which firebase 12.17.0 is the first
release to bundle. The package declares firebase ^12.4.0, so the emitted class does not exist at the
bottom of its own supported range. This cannot ship until that minimum rises, which is #3756.

Metadata

Metadata

Labels

comp: aiFirebase AI Logic / Vertex AI (src/ai).comp: schematicsng add / deploy schematics (src/schematics).priority: P2 (medium)Moderate impact; a workaround exists.type: bugDefect: expected behavior doesn't happen.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions