Firebase commandline to list functions from GCP firebase - firebase

I have 100ds of functions deployed to firebase and I would like to know if I can list the remote functions on my machine using the firebase command line tools.
I want to see the list of functions deployed.
What I am trying to solve is:
Batch deploy functions to avoid deployment limit.
Deployment error when function deleted/renamed locally and then deploying whole functions.
Thanks!

I got the exact answer from Google support.
Currently, Firebase CLI doesn’t have any command to list deployed functions, whereas “gcloud functions list” CLI from Cloud SDK shows the list instead.
More details found here

While it doesn't seem to be documented here, you can list all deployed Cloud Functions when you have firebase-tools installed with firebase functions:list. The command is also mentioned in firebase --help.
Verified with firebase-tools version 10.5.0

At the time of writing this answer, there is no CLI command that allows listing all the deployed functions for your project. The available commands can be found here: https://firebase.google.com/docs/cli/#commands
However, note that you can list the deployed functions in the Google Cloud console (not the Firebase one) by opening: https://console.cloud.google.com/functions/list?project=your_project_name

Related

Firebase functions: failed to create function

Following the Firebase examples to create and deploy a function, I keep failing at the deploy phase.
The error, with --debug enabled, shows:
<<< [apiv2][body] POST
https://cloudfunctions.googleapis.com/v1/projects/actus-poc2/locations/us-central1/functions
{"error":{"code":403,"message":"Cloud Functions uses Artifact Registry
to store function docker images. Artifact Registry API is not enabled
in your project. To enable the API, visit
https://console.developers.google.com/apis/api/artifactregistry.googleapis.com/overview?project=...
Now I was expecting to be able to stay within the confines of the firebase console but this message seems to imply I need to open the Google Cloud Console to enable additional permissions.
Should the code samples better document this?
Or is this a recent change in firebase functions that breaks many of the existing examples?
I need to open the Google Cloud Console to enable additional permissions.
The reason why you need to use the Google Cloud Console is because Cloud Functions for Firebase relies on some Google Cloud services. See.
Function deployments with Firebase CLI 11.2.0 and higher rely on Cloud Build and Artifact Registry.
is this a recent change in firebase functions that breaks many of the existing examples?
Deployments to older versions also do rely on some Google Cloud services. Deployments to older versions use Cloud Build in the same way, but rely on Container Registry and Cloud Storage for storage instead of Artifact Registry.
Should the code samples better document this?
If you do think an update to said documentation could be helpful, here is more about opening Feature requests.

Download or sync Firebase Functions to local environment

I am working on a Firebase project that currently uses several Cloud Functions.
The thing is that I want to download or sync the Cloud Functions to the local environment on my laptop.
I mean some command using firebase-tools or another like:
git clone [project name]
git fetch [something]
Usually, we create some cloud functions using the Firebase Console, and I would like to have these functions locally to edit these when needed and deploy them again.
I know that firebase-tools have these two commands, but it is only for configurations:
functions:config:clone [options]
functions:config:get [options]
There's no provided solution for automatically copying or synchronizing functions that have already been deployed. You can certain get the source code for deployed functions, but the Firebase CLI will not automate that process for you.
Ideally, you will want to manage all of your functions from the same source control and CLI in order to deal with them all consistent. Editing functions from the console is primarily a convenience, not a proper deployment mechanism.

Firebase CLI - How to Manage Cloud Functions

Using the firebase-cli you can easily deploy functions and show the logs. But I have yet to find the option to download or retrieve cloud functions.
I've dug through quiet a bit of the -h commands and nothing yet.
Is it possible to download / retrieve a projects cloud functions through the firebase-cli? I tend to switch between computers from home to work and I need to go to the console to copy the source code and redeploy.
The Firebase CLI doesn't provide a way to get deployed code. It's expected that you use some form of source control for managing code between developers and machines.

Cloud Functions deployment failiure from Firebase

I seem to be unable to deploy Google Cloud Functions successfully.
I have created a project on Google Cloud Platform and then proceeded to link it to Firebase via the Firebase console. I select ADD PROJECT and Add Firebase to an existing project. Everything seems to link.
When I try to deploy a cloud function (the simple helloWorld that comes with installing firebase-tools) I keep getting deployment errors. This also happens when trying to deploy functions from Google Cloud Functions dashboard as well.
The error is something aboud setting up the environment.
After ttrying to rename the function to something else, I seem to have luck with deploying but then the function but there is a communication error Function load error: Error: cannot communicate with function.
I am unable to deploy functions on two of my projects, and firebase has been acting very strangely in the last few days, so can somebody please tell me if I am doing something wrong or is it a Firebase glitch
Maybe because there is an outage starting from early this morning. Check status here: https://status.firebase.google.com

Debugging Firebase Cloud Functions using Stackdriver

I am following this doc to try to debug my firebase cloud function: https://cloud.google.com/functions/docs/monitoring/debugging
First of all the
The require line given in the doc was wrong so I changed it to this to make it compile:
require('#google-cloud/debug-agent').start();
Also after implementing this and deploying the functions using firebase deploy --only functions there is no code in stack drive debug view. Any idea how to make this work?
Thanks :)
Currently, Cloud Functions for Firebase do not share their code with Stackdriver automatically. You'll need to source your code via Github, Bitbucket, or a Google Cloud Source Repository.
While debugging Cloud Functions for Firebase please refer to our documentation. We'll make sure to note any differences between the environments.

Resources