Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rewrite routes from hosting to cloud functions from other regions than us-central1

I have a http triggered cloud function deployed in the europe-west1 region and a web app hosted with firebase hosting. I have also setup a rewrite to that http function in my firebase.json file.

I have noticed that the rewrite only works with us-central1 functions.

Is there a way to make the rewrite work with europe-west1 functions?

like image 936
dergoegge Avatar asked Jul 04 '18 17:07

dergoegge


People also ask

Can I change firebase hosting URL?

You can't change your domain, but you can change the host! You can make as many sites as you want.

What are cloud functions firebase?

Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.

What types of cloud functions exist?

There are two types of Cloud Functions: HTTP functions, which handle HTTP requests and use HTTP triggers. See Write HTTP functions for information about implementing HTTP functions. Event-driven functions, which handle events from your cloud environment and use event triggers as described in Cloud Functions triggers.

What region should I Run my Cloud Functions in?

When selecting what region to run your Cloud Functions in, your primary considerations should be latency and availability. You can generally select the region closest to your Cloud Function's users, but you should also consider the location of the other Google Cloud products and services that your app uses.

What regions is ucloud functions available in?

Cloud Functions is available in the following regions: us-central1 (Iowa) us-east1 (South Carolina) us-east4 (Northern Virginia)

How do I set a default region for Cloud Functions?

You can set a default region using the gcloud command-line tool as follows: Cloud Functions provides a data residency guarantee at the function execution scope (Scope A Compliance—function execution), wherein a given function provides for data residency for the function invocation/execution.

How to rewrite a Firebase Cloud function link?

To rewrite your Cloud Function link go to the /firebase.json file. In the rewrites array add this object before the existing one: Run firebase deploy --only hosting to send changes to the server.


2 Answers

Now that there is official support for other regions it states in the docs that "If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1". So i think we have to wait and see if they will change that.

like image 93
dergoegge Avatar answered Oct 03 '22 22:10

dergoegge


As of 2021, Hosting rewrites to functions work for us-central1 region only

Firebase Hosting supports Cloud Functions in us-entral1 only

like image 33
Abraham Avatar answered Oct 03 '22 22:10

Abraham