Was briefly mentioned here, but right now I'm at the point where I've connected my GCP project to Firebase, set up a custom domain under Firebase hosting, but on the functions page of the Firebase dashboard, there doesn't seem to be a way to set the vanity URL on a cloud function.
My firebase.json (at the root of my project) looks like :
{
"hosting": {
"public": "public",
"rewrites": [
{ "source": "/helloWorld", "function": "helloWorld" },
{ "source": "/progress", "function": "progress" }
]
}
}
Scroll down in 'Manage Site' and create a new site, then deploy there. You can't change your domain, but you can change the host! You can make as many sites as you want.
If you connect your Cloud project with Firebase, you can connect your HTTP-triggered Cloud Functions to Firebase Hosting to get vanity URLs. This user is first on the weekly Google Cloud leaderboard.
Run firebase deploy --only functions to deploy your Cloud Function inside the functions directory. Your function was deployed but — you have an ugly link from Google. To rewrite your Cloud Function link go to the /firebase.json file. In the rewrites array add this object before the existing one:
The Firebase CLI creates a .zip archive of the function code, which is then uploaded to a Cloud Storage bucket (prefixed with gcf-sources) in your Firebase project. Cloud Build retrieves the function code and builds the function source.
You write code for a new function, selecting an event provider (such as Cloud Firestore), and defining the conditions under which the function should execute. The Firebase CLI creates a .zip archive of the function code, which is then uploaded to a Cloud Storage bucket (prefixed with gcf-sources) in your Firebase project.
To associate a vanity domain with your Cloud Functions, you need to associate them with Firebase Hosting. See the documentation on connecting the two.
Say you have a Cloud Function https://us-central1-<your-project-id>.cloudfunctions.net/bigben
.
After making this connection the function will also be available on https://<your-project-id>.firebaseapp.com/bigben
.
If you also connect a custom domain with Firebase Hosting, the function will also be available on https://<your-custom-domain>.com/bigben
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With