google-cloud-functions

Using Flask Routing in GCP Function?

孤街浪徒 提交于 2020-02-03 05:04:04
问题 I am looking to serve multiple routes from a single GCP cloud function using python. While GCP Functions actually use flask under the hood, I can't seem to figure out how to use the flask routing system to serve multiple routes from a single cloud function. I was working on a very small project, so I wrote a quick router of my own which is working well. Now that I'm using GCP Functions more, I'd either like to figure out how to use the Flask router or invest more time on my hand rolled

Firebase - Swift 4: Message sent but not received

我只是一个虾纸丫 提交于 2020-02-02 14:38:48
问题 Ran pod update on the terminal to update my firebase. However i don't receive FCM's This is my app delegate code: import UIKit import Firebase import FirebaseFirestore import StoreKit import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate { var window: UIWindow? override init() { super.init() FirebaseApp.configure() // not really needed unless you really need it FIRDatabase.database()

Firebase - Swift 4: Message sent but not received

两盒软妹~` 提交于 2020-02-02 14:38:04
问题 Ran pod update on the terminal to update my firebase. However i don't receive FCM's This is my app delegate code: import UIKit import Firebase import FirebaseFirestore import StoreKit import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate { var window: UIWindow? override init() { super.init() FirebaseApp.configure() // not really needed unless you really need it FIRDatabase.database()

Restrict access to Google Cloud Function

混江龙づ霸主 提交于 2020-02-02 13:13:48
问题 I have successfully deployed a Cloud Function that does some basic pre-processing to some data and uploads it to gSheet. Now, the trigger url accepts external unauthenticated invocations, leading to the risk of excessive bills in case the url ends up in the wrong hands. I am wondering if there's any way to restrict invocation to Cloud Scheduler in IAM, preventing external calls to the service altoghether. Reading around it seems that including some header in the request and checking for it in

Firebase cloud function “Your client does not have permission to get URL /200 from this server”

一笑奈何 提交于 2020-02-01 01:38:50
问题 I just made a firebase cloud function : exports.deleteAfterSevenDays = functions.https.onRequest((req, res) => {... I deployed the function and got a function URL. When I request this url from my browser I get the following message : "Error: Forbidden Your client does not have permission to get URL /200 from this server." I have just updated to firebase Blaze plan because I thought there were limitations with Spark plan, but it still doesn't work. In my firebase cloud function logs it is

How to use Apify on Google Cloud Functions

心不动则不痛 提交于 2020-01-30 12:27:57
问题 I'm deploying some code using Apify as Google Cloud Functions. When triggered, the Cloud Function terminates silently. What am I doing wrong? I have some working code using Apify 0.15.1. It runs fine locally. Once deployed as a Google Cloud Function, it fails silently without any clear error. The equivalent code using Puppeteer 1.18.1 works fine. I've reproduced the issue using more simple code below. While this example doesn't strictly require Apify, I would like to be able to use the extra

Do Cloud Functions use the same IP when sending requests

邮差的信 提交于 2020-01-30 11:25:27
问题 So I am running an web service API on Cloud Functions with express.js. I am wondering if cloud functions use the same IP address to send requests every time. My users are sending requests and getting responses from the CFs. Every time a user sends a request, CF sends a request to third party API to get some data. I want to be able to limit the number of requests sent to the third party API each minute by the CFs. The third party API has an IP limitation, so Im trying to send requests from

update cloud firestore document without id

﹥>﹥吖頭↗ 提交于 2020-01-30 09:33:26
问题 My Cloud Firestore looks like this: users ├────random_id_1───{name, email, ...} ├────random_id_2───{name, email, ...} ... └────random_id_n───{name, email, ...} I want to update a document of users given I have an unique identifier for it that is NOT the random id of the document (suppose, for example, the name is unique and I want to use it as identifier). How can I update a document identifying it by a field of it? 回答1: Firestore can only update documents for which it knows the complete

How to resolve/return a forEach function in Cloud Functions

孤街浪徒 提交于 2020-01-25 23:01:28
问题 I have the following (sample) array: pages = [ { "name" : "Hello", "id" : 123 },{ "name" : "There", "id" : 987 },{ "name" : "Great", "id" : 555 } ]; I want to save every object in this array as Document in a Collection. Therefor I have the following function: exports.testSaveFacebookPages = functions.https.onRequest((req, res) => { cors(req, res, () => { let userUid = req.body.uid // pages array is available here... const PagesRef = admin.firestore().collection(`/users/${userUid}/pages/`)

How to scope Firebase in nested promise Cloud Functions

醉酒当歌 提交于 2020-01-25 21:43:11
问题 I am trying to set a few variables from Firebase and then pass those into a anotherfunction. Currently, the Promise.all is properly setting foo and bar, but an error is being thrown during the .then , so the response isn't getting set in Firebase. const functions = require('firebase-functions'), admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.someFunc = functions.database.ref(`/data`).onWrite(event => { const condition = event.data.val() if