Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unpredictable URLs with Firebase Cloud Functions 2nd gen

I am used to Firebase Functions and now trying to set up a project with Firebase Cloud Functions 2nd Gen.

When I deploy my functions they do not get the predictable URLs that I know from 1st gen (like: https://europe-west1-[project-slug].cloudfunctions.net/[function-name]), but rather some weird URLs like this one: https://[function-name]-kbnn7zbc7q-uc.a.run.app).

I can't find any mentions of this in the documentation and I expect there may be a setting to get a more predictable scheme for functions URLs?

like image 647
Simon Kibsgård Avatar asked Mar 23 '26 17:03

Simon Kibsgård


2 Answers

As of now at least, there is also a deterministic URL for functions.

The tutorial adds this:

Both 1st gen and 2nd gen functions have assigned URLs that have the following format. These URLs have a deterministic format, meaning that you can predict what the URL will be before you deploy the function:

https://REGION-PROJECT_ID.cloudfunctions.net/FUNCTION_NAME

Firebase (unhelpfully) shows the non-deterministic URL. You can see the deterministic URL in the GCP console for functions if you are like me and don't completely trust the URL pattern above.

like image 55
Brent McCullough Avatar answered Mar 25 '26 16:03

Brent McCullough


There is currently no such option. Cloud Functions 2nd gen is actually built on top of another cloud service called Cloud Run. The URL you're seeing is a Cloud Run URL (note run.app).

There are mentions in GCP Cloud Functions doc about this URL. In particular, in this tutorial, it says:

Note: Currently, function URLs in Cloud Functions (2nd gen) use a non-deterministic format, meaning you cannot predict your function URL before deployment, though the URL remains stable after deployment. In a future release, function URLs will be updated to be both stable and deterministic.

Also in gcloud docs:

Note: Currently, function URLs in Cloud Functions (2nd gen) use a non-deterministic format, meaning you cannot predict your function URL before deployment, though the URL remains stable after deployment. In a future release, function URLs will be updated to be both stable and deterministic.

Firebase just uses the underlying GCP products, so it inherits the same properties of the generated URL.

like image 35
Doug Stevenson Avatar answered Mar 25 '26 15:03

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!