Skip to content

Function endpoint not found when deploying multiple hosting targets #9235

Closed

Description

@fwal

[REQUIRED] Environment info

firebase-tools: 14.17.0

Platform: macOS

[REQUIRED] Test case

firebase.json

{
  "functions": [
    {
      "codebase": "exampleCodebase",
      "source": "example-codebase"
    }
  ],
  "hosting": [
    {
      "target": "example-api",
      "public": "site/example-api",
      "rewrites": [
        {
          "source": "/v1/**",
          "function": {
            "functionId": "runApiV1"
          }
        },
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "example-dynamic",
      "public": "site/example-dynamic",
      "rewrites": [
        {
          "source": "**",
          "function": {
            "functionId": "hostExampleDynamicSite"
          }
        }
      ]
    },
    {
      "target": "example-static",
      "public": "site/example-static",
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ]
}

[REQUIRED] Steps to reproduce

  1. Deploy all sites using firebase deploy --only hosting

[REQUIRED] Expected behavior

All hosting deployed successfully or deployment failure.

(Deploying the sites individually (e.g. firebase deploy --only hosting:example-dynamic) works)

[REQUIRED] Actual behavior

$ firebase deploy --only hosting

=== Deploying to 'example-project'...

i  deploying hosting
i  hosting[example-api]: beginning deploy...
i  hosting[example-api]: found 3 files in site/example-api
✔  hosting[example-api]: file upload complete
i  hosting[example-dynamic]: beginning deploy...
i  hosting[example-dynamic]: found 6 files in site/example-dynamic
✔  hosting[example-dynamic]: file upload complete
i  hosting[example-static]: beginning deploy...
i  hosting[example-static]: found 62 files in site/example-static
✔  hosting[example-static]: file upload complete
i  hosting[example-api]: finalizing version...
i  hosting[example-dynamic]: finalizing version...
i  hosting[example-static]: finalizing version...
⚠  hosting[example-dynamic]: Unable to find a valid endpoint for function `hostExampleDynamicSite`, but still including it in the config
✔  hosting[example-static]: version finalized
i  hosting[example-static]: releasing new version...
✔  hosting[example-dynamic]: version finalized
i  hosting[example-dynamic]: releasing new version...
✔  hosting[example-static]: release complete
✔  hosting[example-dynamic]: release complete
✔  hosting[example-api]: version finalized
i  hosting[example-api]: releasing new version...
✔  hosting[example-api]: release complete

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/example-project/overview
Hosting URL: https://example-api.web.app
Hosting URL: https://example-dynamic.web.app
Hosting URL: https://example-static.web.app

https://example-dynamic.web.app/subpage site now returns the following:

Error: Page not found

The requested URL was not found on this server.

Activity

  1. fwal commented on Oct 2, 2025

    @fwal
    Author

    I made a PR with the deploys running in sequence and that works (#9214) however I'm unsure about any underlying issues that's causing this.

  2. aalej commented on Oct 2, 2025

    @aalej
    Contributor

    Hey @fwal, thanks for the detailed report and for opening up a PR! I was able to reproduce the issue you reported. Though in my case, the rewrites to the function(curl https://example-dynamic.web.app/subpage) still serves the expected content which is the response from the hostExampleDynamicSite function. Sharing my mcve here

    I’ll raise this to our engineering team so they can take a look.

  3. fwal commented on Oct 2, 2025

    @fwal
    Author

    Hi @aalej and thanks for looking into it! I've tested your mcve and it does indeed not fail.

    However, I realize I haven't included the region in my report (sorry about that!): My functions run in europe-west1 and if I update your mcve to reflect that, it too fails when requesting curl https://example-dynamic.web.app/subpage (probably defaults to us-central1 when the function isn't found)

    Let me know if you or your team need anymore details.

  4. aalej commented on Oct 2, 2025

    @aalej
    Contributor

    You're right! I was able to reproduce the Error: Page not found when the function region was set to something other than us-central1, thanks for pointing this out! This definitely looks like a a bug. I'll update the mcve to include this.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions