google-cloud-functions

Firestore delete vs update time and performance

妖精的绣舞 提交于 2021-02-17 05:38:07
问题 I have coded a match making system and this system works like that --> when a create operation came to firestore it matches with an older record and the cloud function deletes both of them. But i wonder that when 2 new records are created, is there any chance for matching these 2 with the same old record because the deletion process takes some time? Also, if i do that process with update, is it faster than delete? EDIT: Here is my matchMaker Cloud Function: exports.matchMaker = functions

Cant get Firebase Storage security rules to refuse access to a file

做~自己de王妃 提交于 2021-02-16 18:50:08
问题 I'm sure I'm missing something wrt Firebase Storage rules, but I've done the following: STEP 1 Firstly I set the following Firebase Storage rule: service firebase.storage { match /b/{bucket}/o { match /items/{dev_key}/{perm_id}/{file_name} { allow write: if request.auth.uid == dev_id; allow read: if request.auth.token.permId == perm_id; } } } I expected only signed in users with a custom claim permId matching the relevant location to be able to download the file, allow read: if request.auth

How to avoid loops when writing cloud functions?

两盒软妹~` 提交于 2021-02-16 13:36:49
问题 When writing event based cloud functions for firebase firestore it's common to update fields in the affected document, for example: When a document of users collection is updated a function will trigger, let's say we want to determine the user info state and we have a completeInfo: boolean property, the function will have to perform another update so that the trigger will fire again, if we don't use a flag like needsUpdate: boolean to determine if excecuting the function we will have an

How to avoid loops when writing cloud functions?

给你一囗甜甜゛ 提交于 2021-02-16 13:33:15
问题 When writing event based cloud functions for firebase firestore it's common to update fields in the affected document, for example: When a document of users collection is updated a function will trigger, let's say we want to determine the user info state and we have a completeInfo: boolean property, the function will have to perform another update so that the trigger will fire again, if we don't use a flag like needsUpdate: boolean to determine if excecuting the function we will have an

Firebase Cloud functions: ECONNREFUSED

微笑、不失礼 提交于 2021-02-15 05:12:20
问题 I am trying the Optimizing Networking of firebase cloud functions like here with Typescript const http = require('http'); const functions = require('firebase-functions'); const agent = new http.Agent({keepAlive: true}); export const getXXX = functions.https.onRequest((request, response) => { const req = http.request({ host: 'localhost', port: 443, path: '', method: 'GET', agent: agent, }, res => { let rawData = ''; res.setEncoding('utf8'); res.on('data', chunk => { rawData += chunk; }); res

Firebase Cloud functions: ECONNREFUSED

限于喜欢 提交于 2021-02-15 05:10:15
问题 I am trying the Optimizing Networking of firebase cloud functions like here with Typescript const http = require('http'); const functions = require('firebase-functions'); const agent = new http.Agent({keepAlive: true}); export const getXXX = functions.https.onRequest((request, response) => { const req = http.request({ host: 'localhost', port: 443, path: '', method: 'GET', agent: agent, }, res => { let rawData = ''; res.setEncoding('utf8'); res.on('data', chunk => { rawData += chunk; }); res

MongoDB and Google Cloud Functions VPC Peering?

非 Y 不嫁゛ 提交于 2021-02-13 17:33:23
问题 I've having issues accessing MongoDB Atlas from Google Cloud functions. It is giving me error regarding IP Whitelisting but I've added both (Serverless VPC Access) IP address range and VPC Network Peering IP address range to MongoDB whitelist. I've also created MongoDB peering with google cloud. If I allow (access from anywhere) then my mongodb starts working fine, otherwise it gives error regarding IP whitelisting. I'm not sure what else I should add to MongoDB whitelist when I've added both

MongoDB and Google Cloud Functions VPC Peering?

ぐ巨炮叔叔 提交于 2021-02-13 17:33:21
问题 I've having issues accessing MongoDB Atlas from Google Cloud functions. It is giving me error regarding IP Whitelisting but I've added both (Serverless VPC Access) IP address range and VPC Network Peering IP address range to MongoDB whitelist. I've also created MongoDB peering with google cloud. If I allow (access from anywhere) then my mongodb starts working fine, otherwise it gives error regarding IP whitelisting. I'm not sure what else I should add to MongoDB whitelist when I've added both

Node.js confusion about buffers, streams, pipe, axios, createWriteStream, and createReadStream

大憨熊 提交于 2021-02-11 15:21:54
问题 I'm trying to download an audio file (about 250KB) from Firebase Storage and send it to IBM Cloud Speech-to-Text, using Firebase Cloud Functions (Node 8). I'm using axios to send the HTTP GET request to the download URL. axios returns a stream so I use fs.createReadStream(response) to stream the file to IBM Cloud Speech-to-Text. I don't get an error message, rather nothing is sent to IBM Cloud Speech-to-Text. exports.IBM_Speech_to_Text = functions.firestore.document('Users/{userID}

Ionic: Is it possible to delay incoming push FCM push notification from showing to my device until a specific time

与世无争的帅哥 提交于 2021-02-11 14:55:32
问题 So i am using Firebase for my project. And what is does is that every time a new record is added into a specific collection in Firestore, my Firebase Function will be triggered thus sending the push notification into the devices of users who are subscribe to a specific topic. Here is the code that i used for Firebase Function: exports.sendNotifications = functions.firestore .document('notifications/{sessionId}').onCreate(async event => { const newValue = event.data(); // Gets data from the