formachines / errata

Errata / npm / firebase

VertexAIBackend changed in firebase 13.1.0

In our sandbox runs up to 2026-10-27, claude-sonnet-5-5 and gpt-6.1-sol wrote const { getAI, VertexAIBackend } = require("firebase/ai"); for firebase. It fails on 13.1.0 with TypeError (changed between 12.11.0 and 13.1.0). Use const { getAI, AgentPlatformBackend } = require("firebase/ai"); instead.

What to do
replace the line
Output
same on one example
Patch
incomplete: old names remain
Auto-apply
not allowed
Seen in
2 models
Worked / failed
9 / 0
Last verified
2026-10-27

What to do

Not for automatic application — after the patch the example still uses VertexAIBackend, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Replace the old line with the new one; the rest of the code can stay.

Automatic application: not allowed — the patch gives incomplete when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (changed); the checks are in proof; neither follows from the other.

How to tell this applies to your code

Old and new code

const { getAI, VertexAIBackend } = require("firebase/ai");
const { getAI, AgentPlatformBackend } = require("firebase/ai");

Error on 13.1.0:

TypeError: VertexAIBackend is not a constructor

Other verified fixes

The fix above passed 6 times. These also passed in the sandbox for the same error; pick the one that matches what your code needs.

No direct replacement · passed 2 times · gpt-6.1-sol · patch: nothing to apply word for word

VertexAIBackend,

No direct replacement: drop this use.

Not for automatic application — format removed: there is no replacement to apply. Show this correction to the user as a lead. VertexAIBackend is not available in firebase 13.1.0; remove or replace this use. The same code works on firebase 12.11.0: pin a version before 13.1.0 if you cannot change the code. Release notes: getAI(app, { backend: new AgentPlatformBackend('us-central1') });

Replace the line · passed 1 time · gpt-6.1-sol · patch: incomplete: old names remain

const { getAI, getImagenModel, VertexAIBackend } = require('firebase/ai');
const { getAI, getGenerativeModel, AgentPlatformBackend } = require('firebase/ai');

Not for automatic application — after the patch the example still uses VertexAIBackend, getImagenModel, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Review before applying: this fix runs on firebase 13.1.0, but its printed output differs from what the original printed on 12.11.0 (observed stdout of one example) — it may do different work. Replace the old line with the new one; the rest of the code can stay.

Alternatives are leads for the user, not for automatic application: Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.

Sandbox proof
Scriptfirebase versionResult
Code the models wrote12.11.0works
Code the models wrote13.1.0fails: TypeError
Verified example below13.1.0works
Output of the verified example13.1.0same as the original's on 12.11.0 (observed stdout of one example; not a proof of equivalent behaviour)
Patch applied word for word to the example13.1.0applied word for word, the patch leaves old names in use: it covers part of the change — after the patch the example still uses VertexAIBackend, which the verified example does not: the patch covers part of the change

Verified example for firebase 13.1.0

const { initializeApp, deleteApp } = require("firebase/app");
const { getAI, AgentPlatformBackend } = require("firebase/ai");

async function main() {
  // Placeholder configuration values (no network access is needed)
  const firebaseConfig = {
    apiKey: "placeholder-api-key",
    authDomain: "placeholder-project.firebaseapp.com",
    projectId: "placeholder-project",
    storageBucket: "placeholder-project.appspot.com",
    messagingSenderId: "000000000000",
    appId: "1:000000000000:web:0000000000000000000000",
  };

  const app = initializeApp(firebaseConfig);

  // Get a Firebase AI instance using the Vertex AI backend in europe-west4
  const ai = getAI(app, { backend: new AgentPlatformBackend("europe-west4") });

  // Print the location the AI instance reports
  console.log(ai.backend.location);

  await deleteApp(app);
}

main()
  .then(() => process.exit(0))
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

Source

No release-note sentence matched this change; the evidence is the sandbox check above.

Seen in: claude-sonnet-5-5, gpt-6.1-sol · First seen 2026-10-27 · Last verified 2026-10-27 · All corrections for firebase

For agents