Skip to content

deploy failing due to incorrect Hosting API URL #6564

Closed

Description

@leoortizz

[REQUIRED] Environment info

firebase-tools: latest

Platform: macOS, GitHub action

[REQUIRED] Test case

We started having errors with deployments on GitHub actions, then I tried to replicate locally and got the same error. The final error we get on deploy is:
Error: Unable to parse JSON: SyntaxError: Unexpected token < in JSON at position 0

While debugging I found that listSites here:

const sites = await api.listSites(project);

returns this object:

[
    {
      name: 'projects/<project-id>/sites/<site-id>',
      defaultUrl: 'https://<project-id>.web.app/',
      appId: '....',
      type: 'DEFAULT_SITE'
    }
]

Then, the URL that the Firebase CLI is calling here:

const allVersionsNested = await Promise.all(sites.map((site) => api.listVersions(site.name)));

const res = await apiClient.get<ListVersionsResponse>(`projects/-/sites/${site}/versions`, {
queryParams,
});

is:

https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/projects/<project-id>/sites/<site-id>/versions

Note /sites showing up twice. Basically the URL is invalid so it’s 404ing, leading to a HTML 404 page from Hosting being returned in the API call, which expects a JSON.

This one works:

https://firebasehosting.googleapis.com/v1beta1/projects/-/sites/<site-id>/versions

I was able to deploy locally with #6565, however I don't know where the fix should be applied in case a similar problem occurs elsewhere.

[REQUIRED] Steps to reproduce

firebase deploy

[REQUIRED] Expected behavior

deploy works

[REQUIRED] Actual behavior

deploy errors out because of invalid URL in Hosting API

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