Firebase Remote Config Triggers
Cloud Run functions can be triggered in response to changes in Firebase Remote Config in the same Google Cloud project as the function. This makes it possible to change the behavior and appearance of your app without publishing an app update.
Event types
Firebase Remote Config can trigger functions in response to the
remoteconfig.update
event.
Event Type | Trigger |
---|---|
remoteconfig.update |
Triggered when the remote config template is updated. |
Event structure
Event data is provided as a transformed remoteConfig
object.
For example:
{ "updateType": "FORCED_UPDATE", "updateOrigin": "CONSOLE", "versionNumber": 1 }
Sample code
Node.js
Python
Go
Java
C#
Ruby
PHP
Deploying your function
To deploy your function, you need to specify the event type
google.firebase.remoteconfig.update
.
The following gcloud
command deploys a function that is triggered
by a Firebase Remote Config event:
gcloud functions deploy FUNCTION_NAME \ --no-gen2 \ --entry-point ENTRY_POINT \ --trigger-event google.firebase.remoteconfig.update \ --runtime RUNTIME
Argument | Description |
---|---|
FUNCTION_NAME |
The registered name of the Cloud Run function you are deploying.
This can either be the name of a function in your
source code, or an arbitrary string. If FUNCTION_NAME is an
arbitrary string, then you must include the
--entry-point flag.
|
--entry-point ENTRY_POINT |
The name of a function or class in your source code. Optional, unless
you did not use FUNCTION_NAME
to specify the
function in your source code to be executed during deployment. In that
case, you must use --entry-point to supply the name of the
executable function.
|
--trigger-event google.firebase.remoteconfig.update |
Trigger the function upon Firebase Remote Config update events. |
--runtime RUNTIME |
The name of the runtime you are using. For a complete list, see the
gcloud reference.
|