Skip to content

SvelteKit SSR deploy fails with "Failed to replace Run service" - ALREADY_EXISTS revision conflict #10136

@BBream

Description

@BBream

[REQUIRED] Environment info

  • firebase-tools: 15.11.0 (also reproduced with 15.10.1)
  • Platform: macOS (local) / Ubuntu (GitHub Actions)
  • Node.js: 22.22.1 (also reproduced with 20.19.3)
  • Framework: SvelteKit 2 + @sveltejs/adapter-node

First observed: March 19, 2026 at approximately 12:00 UTC (9 PM KST). The same deployment pipeline last succeeded at approximately 09:00 UTC (6 PM KST) on the same day — no project or CI configuration changes were made between the two runs.

[REQUIRED] Test case

SvelteKit project deployed to Firebase Hosting with webframeworks experiment enabled. firebase.json:

{
  "hosting": {
    "target": "app",
    "source": "./",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "frameworksBackend": {
      "region": "asia-northeast3"
    }
  }
}

[REQUIRED] Steps to reproduce

  1. Enable FIREBASE_CLI_EXPERIMENTS=webframeworks
  2. Run npx firebase-tools hosting:channel:deploy <channel> --only app --expires 7d --project <project-id>
  3. Also fails with firebase deploy --only hosting (live channel)

[REQUIRED] Expected behavior

Hosting deployment succeeds, Cloud Run service is updated with the new revision and traffic tag.

[REQUIRED] Actual behavior

Cloud Functions create/update succeeds, but immediately after, hosting: finalizing version fails:

✔ functions[...<ssr-function-name>(<region>)] Successful create operation.
i hosting[<site-name>]: finalizing version...
Error: Failed to replace Run service projects/<project-number>/locations/<region>/services/<ssr-function-name>

Debug log shows:

PUT https://run.googleapis.com/v1/projects/<project-number>/locations/<region>/services/<ssr-function-name>
HTTP 409: Revision named '<ssr-function-name>-00002-xxx' with different configuration already exists.

Root cause analysis

  • Cloud Functions deployment creates revision 00001 with a specific configuration
  • Hosting finalize then calls ReplaceService (PUT) to add a traffic tag (fh-xxxx) to the same service
  • This PUT request tries to create revision 00002 but with a different image digest/configuration than what Cloud Functions just built
  • Result: 409 ALREADY_EXISTS

Reproduction rate

100% — fails on every attempt across:

  • Local CLI and GitHub Actions
  • Node.js 20 and 22
  • firebase-tools 15.10.1 and 15.11.0
  • asia-east1 and asia-northeast3 regions
  • Both hosting:channel:deploy and firebase deploy --only hosting
  • Both fresh function creation and existing function update

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions