Skip to content

Function endpoint not found when deploying multiple hosting targets #9235

@fwal

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.

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