Google Cloud Function that pulls messages from Pub/Sub and saves them in Firestore.
This documentation builds upon that in the repo blockchain-etl/bigquery-to-pubsub.
gcloud config set project <PROJECT-NAME>
gcloud services enable cloudbuild.googleapis.com
gcloud services enable cloudfunctions.googleapis.com
firebase login --reauth --no-localhost
Visit
https://console.firebase.google.com/project/<PROJECT-NAME>
/firestore
We recommend creating in production
mode, data stored in nam5
(us-central
).
firestore init firebase
For example, the contents might be:
#!/usr/bin/env bash
FUNCTION_NAME=transactions-pubsub-to-firestore
FUNCTION_RUNTIME=nodejs12
FUNCTION_TRIGGER_TOPIC=bigquery-to-pubsub-test0
FIRESTORE_COLLECTION_NAME=transactions
bash deploy.sh config.sh
Assuming there are unexpired messages in $FUNCTION_TRIGGER_TOPIC
, the
deployed function will immediately begin to process them and insert into the
Firestore collection $FIRESTORE_COLLECTION_NAME