google-cloud-functions

Firebase Functions environment variables

梦想的初衷 提交于 2020-03-19 03:27:30
问题 So i was migrating my app from node express to firebase-functions! In my node-express app I have .env file which contains all the data, FOr starters let's consider this as my .env file GOOGLE_CLIENT_ID = 4046108-bssbfjohpj94l0dhpu69vpgs1ne0.apps.googleusercontent.com GOOGLE_CLIENT_SECRET = lTQHpj3yY57oQpO And then in my passport strategy, I have something like this passport.use(new GoogleStrategy({ clientID: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET,

How to automatically backup Firestore database daily

本秂侑毒 提交于 2020-03-18 04:15:12
问题 I would like to backup a Firestore database on a daily basis. My data structure is like this: usersCollection uid defaultCurrency: 'USD' name: 'something' dreamsCollection name image I have looked at firestore-export-import and node-firestore-backup to do the backup and export the data to a JSON file. My questions are: If I create a cloud function how do I run the cloud function daily? What is the best way to do the backup? Should I store the data in firebase storage and how to do this?

Can not see the Firebase function deployed

风格不统一 提交于 2020-03-17 05:39:48
问题 I followed the following steps: The Firebase CLI (Command Line Interface) requires Node.js and npm, which you can install by following the instructions on https://nodejs.org/ Installing Node.js also installs npm Once you have Node.js and npm installed, install the Firebase CLI via npm: npm install -g firebase-tools This installs the globally available firebase command. To update to the latest version, re-run the same command Initialize your project: a. Run firebase login to log in via the

How to throw a custom message using Dialogflow after three times of fallback

冷暖自知 提交于 2020-03-16 06:58:30
问题 I am developing a chatbot using Dialogflow, I would like to throw a message to user when the chatbot doesn't understand the user input for three times in a row and for the forth time respond with a custom message (not the one of the options declared on the dialogflow interface) One idea that I have is to make a counter within the input unknown action like this: var counter = 1; // The default fallback intent has been matched, try to recover (https://dialogflow.com/docs/intents#fallback

How to throw a custom message using Dialogflow after three times of fallback

房东的猫 提交于 2020-03-16 06:57:09
问题 I am developing a chatbot using Dialogflow, I would like to throw a message to user when the chatbot doesn't understand the user input for three times in a row and for the forth time respond with a custom message (not the one of the options declared on the dialogflow interface) One idea that I have is to make a counter within the input unknown action like this: var counter = 1; // The default fallback intent has been matched, try to recover (https://dialogflow.com/docs/intents#fallback

node_modules/firebase-functions/lib/function-configuration.d.ts:4:64 - error TS1005: ']' expected

做~自己de王妃 提交于 2020-03-09 05:01:07
问题 I am getting the following error when executing the command firebase deploy --only function in my Ionic 3 project. This solution is not working for me. Running command: npm --prefix "$RESOURCE_DIR" run build > functions@ build /Users/myuser/Project/functions > tsc node_modules/firebase-functions/lib/function-configuration.d.ts:4:64 - error TS1005: ']' expected. 4 export declare const SUPPORTED_REGIONS: readonly ["us-central1", "us-east1", "us-east4", "europe-west1", "europe-west2", "asia

firestore OnCreate not triggered when creation is done by a sub document or collection

半城伤御伤魂 提交于 2020-03-05 05:54:09
问题 So I am building a chat app using flutter and firebase and I need to trigger a function whenever two new users starting chatting with each other for the first time (whenever one of them sent the first message) so I can store that information somewhere to show it later to the users as chat history (people who've got in contact with). So my data tree looks like this : 'rooms/{roomId}/messages/{messageWithRandomId}' Logically whenever a user sends the first message to another user the room

How to use GCP service account in Google Cloud Function?

徘徊边缘 提交于 2020-03-05 03:54:06
问题 I have a Google Cloud Platform service account with domain-wide authority. I can add it to a Google Analytics API call from my terminal and it works correctly. However, I would like to run that same script as a Google Cloud Function and reference the service account in GCP without including the client_secret_service_account.json file (like below) in the repository or anywhere outside of GCP. Is that possible? KEY_FILE_LOCATION = 'client_secret_service_account.json' 回答1: You can now reference

firebase realtime funtions using multiple databases

孤街醉人 提交于 2020-03-04 19:39:11
问题 We have two different firebase projects each with its own firebase functions and realtime database used. we have come to a situation where we want to leverage one of the dataset (a node in the realtime db) from project 1 into the project 2. As this node is read-only true so i can a access it in the format https://myproject.firebaseio.com/prj1db/nodeX.json but that will give entire data for this node. What i need is to query specific data like i do using below format for the db attached to the

Firebase deploy functions with Sharp library fails in Google Cloud Build

天涯浪子 提交于 2020-03-03 12:24:59
问题 After migrating to Google Cloud Build from Bitbucket Pipelines the Firebase deployment is failing. The setup was deploying successfully both on Bitbucket Pipelines and locally. No further explanation is given other than error below. I have comment parts of the code to to realize that "const sharp = require('sharp')" was one command that was making the build to fail. But there is no apparent reason why "firebase deploy" fails with "require('sharp')" and I have to way to tackle this. Firebase