# Upgrade firebase-functions and firebase-admin

Every Node/ sample was already on firebase-functions 7.4.0 and firebase-admin 14.5.0; lint and tests pass, and compile needs the root devDependencies.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-firebase-functions/firebase-functions/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent runs `pnpm up -L -r firebase-functions firebase-admin` inside `Node/` and checks the result against `npm view`: 7.4.0 and 14.5.0 are the latest, every sample's `functions/package.json` already asks for them, and no sample's `pnpm-lock.yaml` changed. The command did create a stray `Node/pnpm-lock.yaml`, since each sample keeps its own lock; the agent deleted it and left `git status` clean.

For the emulator step it read the three samples that have tests, `test-functions-mocha`, `test-functions-jest` and `test-functions-jest-ts`, and grepped them for Firestore, Realtime Database and Auth. None use those triggers (the mocha sample uses Storage), and the Firestore, RTDB and Auth quickstarts have no tests, so `firebase emulators:exec` had nothing to run.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "In the Node/ directory only, upgrade firebase-functions and firebase-admin to the latest compatible versions with pnpm up -L -r, respecting minimumReleaseAge in pnpm-workspace.yaml, so every sample's package.json and pnpm-lock.yaml move together. Then run npm run bootstrap-2nd-gen, lint-2nd-gen, compile-2nd-gen and test-2nd-gen, and run the samples that use Firestore, Realtime Database or Auth triggers against the Firebase emulators with firebase emulators:exec where they have tests. Leave out any upgrade that breaks the build or tests and say why. Open a pull request with one line per bump and the samples whose tests ran.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on firebase/functions-samples at 5c5ef9a5: no code change. The work was already done, so there was no pull request to open. On the untouched clone `bootstrap-2nd-gen`, `lint-2nd-gen` and `test-2nd-gen` exited 0, the last ending `Tests:       1 passed, 1 total` for the jest-ts sample. `compile-2nd-gen` exited 1 until the agent installed TypeScript 7.0.2 globally and ran `pnpm install --frozen-lockfile --ignore-workspace` at the root for `@types/node`; after that it exited 0 before and after the upgrade command.

For the reviewer: a clean clone cannot compile without the root devDependencies, which `bootstrap-2nd-gen` does not install. One sample pins `firebase-functions` as exactly `"7.4.0"` while the rest use `^7.4.0`. The run used Node 22.23.4 while the samples ask for Node 24, which gave engine warnings only.

## Run it on every Monday morning

An automation with this prompt and a `schedule` trigger, `cron` `0 9 * * 1`, runs it weekly. Until `bootstrap-2nd-gen` installs the root devDependencies, a fresh sandbox must install them first or `compile-2nd-gen` fails with `error TS2688: Cannot find type definition file for 'node'.`

## Why run it on Rush?

A dependency job that finds nothing to do should say so, not invent a bump. This run checked the registry, showed the unchanged lockfiles, and on the way surfaced a compile failure on a clean clone that the repository's bootstrap script does not cover.

## Frequently asked questions

### Why did no emulator tests run?

No sample both has tests and uses a Firestore, Realtime Database or Auth trigger. The agent installed `firebase-tools` and a Java runtime so a future test can run, but there was nothing to point `emulators:exec` at.

### What did the agent have to install?

pnpm 10, `firebase-tools` and TypeScript 7 globally, plus `default-jre-headless` for the emulators, and the root devDependencies so `compile-2nd-gen` could find `@types/node`. TypeScript 7.0.2 is outside `@typescript-eslint/parser`'s peer range (`>=4.8.4 <6.1.0`), which pnpm reported as an unmet peer.

## More Firebase Functions jobs

- [Write Tests for Firebase Cloud Functions](https://getrush.ai/run/write-emulator-tests/firebase-functions/)
- [Enforce App Check on Firebase Callable Functions from a Linear Issue](https://getrush.ai/run/add-app-check/firebase-functions/)
- [Deploy Firebase Functions from GitHub Actions](https://getrush.ai/run/add-deploy-workflow/firebase-functions/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade Laravel 11 to Laravel 13](https://getrush.ai/run/upgrade-framework-major/laravel/)
- [Upgrade Next.js 13 to Next.js 16](https://getrush.ai/run/upgrade-framework-major/nextjs/)
- [Upgrade Phoenix 1.7 to Phoenix 1.8](https://getrush.ai/run/upgrade-framework-major/phoenix/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
