1
votes

Basically what the title states. I'll be replacing the service name with 'xyzservice' and the region name with 'xyzregion' but everything else is exactly as is.

I have a firebase hosting app where I want to access a service running on Google Cloud Run. As per documentation, I'm using a rewrite rule:

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "/api/**",
        "run": {
          "serviceId": xyzservice,
          "region": xyzregion
        }
      },
      {
        "source": "**",
        "function": "app"
      }
    ]
  }
}

I can confirm that I see xyzservice is part of my project when I run gcloud beta run services list

Despite this I keep getting this error:

HTTP Error: 400, Cloud Run service xyzservice does not exist in region xyzregion in this project.

I can't seem to find any information about this error online. Anyone know how I might resolve this?

Thanks in advance!

2
The error 400 indicates that probably something on your code is not correct. Checking the documentation on integrating Cloud Run and Firebase Hosting - this one here - it seems different from what you are doing. Considering that, could you please confirm if the documentation you are following is this same one? If so, could you try this troubleshooting guide, to gather more information from what is causing the error you are seeing?gso_gabriel
What region did you deploy Cloud Run? What region did you configure for your Firebase project? The error message explains the problem: Cloud Run service xyzservice does not exist in region xyzregion in this project. Redeploy your Cloud Run service in the correct region.John Hanley
Hi everyone, thanks for the tips! Checking on the gcp console and using the command above (gcloud beta run services list) I can confirm that the service's region and the firebase rewrite rule's region matches. (they are both set to asia northeast 1, where I am located). @gso_gabriel, could you possibly point out which part of the documentation I need to align more closely with? I believe I am doing something very similar, although I do have a firebase function that rewrites all other routes (deleting that part doesn't fix the problem anyhow).Mr.eggplant

2 Answers

2
votes

Same here. Are you using a region other than us-central1? In my case, changing the region from asia-northeast1 to us-central1 works. I'm not sure if it's a spec change or a failure.

1
votes

Firebase Hosting deployments with rewrites to Cloud Run services located in europe-west1 were broken between 24. - 26. August 2020. I reached out to Google Firebase support. They acknowledged the bug and told me on the morning of 26. August that the issue is now resolved. The configuration above should now perfectly work (as long as the service actually exists).

(It was Firebase Support Case 00080862)