google-cloud-functions

How to get rid of __key__ columns in BigQuery table for every 'Record' Type field?

流过昼夜 提交于 2020-06-17 14:50:34
问题 For every 'Record' Type of my Firestore table, BigQuery is automatically adding the ' key ' columns. I do not want to have these added for each of the 'Record' Type fields. How can I get rid of these extra columns automatically being added by BigQuery? (I want to get rid of the below columns in my BigQuery table schema highlighted in yellow) 回答1: This is intended behavior, citing Bigquery GCP documentation: Each document in Firestore has a unique key that contains information such as the

How to create “likes count” Cloud Firestore aggregate function?

↘锁芯ラ 提交于 2020-06-17 13:21:47
问题 I am newb to firebase, I want to create an aggregate function for the likes count. I have three root collection: feeds, likes, and users. feeds have the following fields: description: <description of feed> likeCount:<Total count of like> title: <feed title> userId: <userId of feed> likes have the following fields: feedId: <id of the feed where a user gives like> likeBy: <id of the user who likes the feed> likeTo: <id of the user how created a feed> users have the following fields: username:

How to create cron jobs dynamically in firebase [duplicate]

徘徊边缘 提交于 2020-06-17 13:13:05
问题 This question already has an answer here : How to create cron jobs in firebase programmatically (1 answer) Closed 14 days ago . Does anyone know how can I set up Cron Jobs dynamically with Firebase? I want to build a rule engine using which the Client can specify the rules, actions, and schedule and based on that I need to schedule that particular rule. Since the scheduling is in the hand of the Client. I can set a predefined frequency for the JOB. I know in Node.js I can do it with libraries

Executing cloud functions after n seconds on demand

时光怂恿深爱的人放手 提交于 2020-06-17 13:09:07
问题 I am working on an application where I have to send notification to the users regarding some job, and user has to accept the job within 1 minute, if he doesn't, the job's request should be sent to the next user. I am using firestore as a database. When I create a job, trigger will send notification to the assigned user. Now I have to wait for 60 seconds to confirm if user has accepted the job and started the procedure, if not I have to assign that job to the new user. I am not sure how I can

Executing cloud functions after n seconds on demand

放肆的年华 提交于 2020-06-17 13:08:08
问题 I am working on an application where I have to send notification to the users regarding some job, and user has to accept the job within 1 minute, if he doesn't, the job's request should be sent to the next user. I am using firestore as a database. When I create a job, trigger will send notification to the assigned user. Now I have to wait for 60 seconds to confirm if user has accepted the job and started the procedure, if not I have to assign that job to the new user. I am not sure how I can

Handling “Unhandled Exception” in React-Firebase Project

半世苍凉 提交于 2020-06-17 09:56:47
问题 Below is a cloud function, that takes data and adds it to two collections in my database. This code returns an "Unhandled Exception" 1 in 10 times. It works most of the time, but randomly returns this error. Code: Cloud Function: let deleteAttributes = (dataArray, attributeArray) => { for (let i = 0; i < dataArray.length; i++){ currentObject = dataArray[i] for (let j=0; j < attributeArray.length; j++) { delete currentObject[attributeArray[j]] } } } exports.addSafe = functions.https.onCall(

How to protect my http-triggered GCP Function with oauth/jwt?

落花浮王杯 提交于 2020-06-17 09:55:07
问题 With AWS Lambda and API Gateway, I can deploy a function exposed with http. With Cognito and API Gateway, I can protect the function with oauth2 and a jwt token. With GCP Function and the http-trigger option, I can deploy a function exposed with http. Is there a "GCP Cognito alternative" I can used to protect my function with oauth2 and a jwt token ? I have tried with "Identity Platform". I can obtain a (not jwt) token with : https://accounts.google.com/o/oauth2/v2/auth?client_id=[my client

How can I view database data when running Firestore local emulator?

强颜欢笑 提交于 2020-06-17 09:32:45
问题 I've setup the Firebase local emulator suite and have my iOS application hitting the local server. I'm wanting to verify whether some cloud functions (on document write) are executing as expected, but I can't validate whether the data is there or not. I can do this by running deploy and checking the Firebase console database tab, but that's only a viable solution during development. I suppose I could also do a get from the iOS client, but hoping there's an easier way to just view the JSON.

NodeJS What is my current Google Cloud Function Name?

十年热恋 提交于 2020-06-17 09:13:07
问题 I want to use the name of the current Google Cloud Function to drive some logic. How do I determine what my Google Cloud Function name is? 回答1: According with this page, there is a set of environment variable automatically set on Cloud Function. Select the right one according with your language runtime FUNCTION_NAME in nodeJS 6 or 8 K_SERVICE in nodeJS10+ 来源: https://stackoverflow.com/questions/62388694/nodejs-what-is-my-current-google-cloud-function-name

Failure to Deploy Cloud Function When Using Wildcard in Trigger

杀马特。学长 韩版系。学妹 提交于 2020-06-17 08:57:04
问题 I'm trying to deploy a cloud function that will trigger whenever a document is added to a particular collection as below: const admin = require("firebase-admin"); const functions = require("firebase-functions"); const Firestore = require("@google-cloud/firestore"); const firestore = new Firestore({ projectId: config.projectId }); admin.initializeApp(config); exports.checkCapacity = functions.firestore.document("gran_canaria/las_palmas_1/miller_pendientes/{albnum}") .onCreate(async (snapshot,