0

Firebase tools auto detects the available functions and deploy when we issue the below command

firebase deploy --only functions

But, we would like to use gcloud cli as it has more control for providing environment variables/for specifying a vpc connector.

Unfortunately, when using gcloud functions deploy, we need to specify the function name for each function.

Is it possible to get the list of http functions/triggers automatically from the source?

Update : As gcloud cli needs the type of the function (http/event), how to find out the type of the exported function automatically so that i can automate instead of specifying each function details?

Ayyappa
  • 1,876
  • 1
  • 21
  • 41

1 Answers1

0

If you are working with source code meant to be deployed to Cloud Functions by the Firebase CLI, you can write code to:

  1. Load (require()) the module defined by index.js
  2. Iterate its exports - each export is expected to be a function to deploy

There is nothing existing that will do this for you - you will have to write the code.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • I just updated the question on how to get the type of the exported function – Ayyappa Dec 25 '20 at 18:20
  • There is really no easy way to do this. It's just not a supported operation. You will have to dig into those exports and see what they contain, or add your own metadata somehow. The code supported by the Firebase CLI was simply not meant to be compatible with gcloud. It is its own system. – Doug Stevenson Dec 25 '20 at 18:22