google-cloud-functions

connecting google cloud function to cloud sql (postgreSQL)

三世轮回 提交于 2021-02-08 11:37:55
问题 I'm trying to connect google cloud function with google cloud sql (postgreSQL). I found document and do exactly same things with document (I think...) but I got error. https://cloud.google.com/sql/docs/postgres/quickstart-connect-functions my cloud function requirements.txt SQLAlchemy==1.3.12 pg8000==1.13.2 and my main.py import sqlalchemy # Set the following variables depending on your specific # connection name and root password from the earlier steps: connection_name = "tram-2020:us

admin.auth().currentUser; returning undefined in Cloud Function

淺唱寂寞╮ 提交于 2021-02-08 11:15:57
问题 I am trying to create a function that, when a device is registered in the app, will attach this device uid to the uid of the signed-in user who registered the device (this is in another firestore collection that is automatically created when a user registers). Here is my code: exports.addDeviceToUser = functions.firestore.document('device-names/{device}').onUpdate((change, context) => { const currentUser = admin.auth().currentUser; const deviceName = context.params.device; var usersRef = db

Firebase how to deploy cloud functions for free

这一生的挚爱 提交于 2021-02-08 10:44:22
问题 i follwed some tutorials to deploy firebase cloud functions step by step and i did not found any of this tutorial spoke about paying or something like this even the official firebase documentation but when i run firebase deploy this command i get this error firebase deploy === Deploying to 'wissal-4736a'... i deploying functions Running command: npm --prefix "$RESOURCE_DIR" run lint > functions@ lint C:\Users\HP\Desktop\aaaa\functions > eslint . + functions: Finished running predeploy script.

Automating the google cloud AutoML pipeline?

為{幸葍}努か 提交于 2021-02-08 10:38:43
问题 I am trying to use the Google AutoML natural language for training the custom text multi-label classifier. Manually, I could do the dataset creation, import data from Google Storage and train the model. However, I want to automate this entire process. My current approach is as follows: I have created google storage bucket to store the annotated data I spin up the Cloud Function to create the dataset, import data into the dataset and train the model. However, importing data into dataset, takes

How to update document in firebase cloud function

こ雲淡風輕ζ 提交于 2021-02-08 10:35:19
问题 In my cloud function I want to update my document from 'dashboard' collection when a new student added to 'students' collection. const getActiveStudents = () => { return db.collection('/students/').where('status', '==', true).get().then( snapshot => { let studentsCount = snapshot.docs.length; db.collection('/dashboard/').where('type', '==', 'students').get().then( result => { if (result.docs.length === 0) { db.collection('dashboard').add({ count: studentsCount, type: 'students', label:

Does redeployment of the same Cloud Function in firebase take up extra space?

Deadly 提交于 2021-02-08 05:33:06
问题 I deployed a cloud function in firebase but instead of using a local emulator for testing purposes, I redeployed it several times to debug and test. After this, I see that my usage in the cloud storage in firebase is upwards of 500 MB although I have not stored any files in the Cloud Storage. Is this due to the multiple redeployments of the function? If yes, will deleting the cloud function free up this space or is there another way. Thanks. 回答1: Yes, deploying a Cloud Function will take up

Firebase Cloud Messaging function sendToDevice not working

走远了吗. 提交于 2021-02-08 05:24:42
问题 I'm using the following code to send a notification from one device to another using FCM. Everything works fine until before return admin.messaging().sendToDevice(...) . The 'Token ID: ' log displays token ID of the receiver, but when I set the variable token_id to the sendToDevice function, the notification is not called, therefore the notification is not sent. Can someone tell me what's wrong? 'use strict' const functions = require('firebase-functions'); const admin = require('firebase

Api gateway for Microservices with Google Cloud Functions

亡梦爱人 提交于 2021-02-08 03:42:25
问题 Inputs For example, we have a few services. Account service Product service Payment service Each service is a separate Google Cloud Function. Each service has its own HTTP API. For example, the account service has: https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/sign-up https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/sign-in https://REGION-FUNCTIONS_PROJECT_ID.cloudfunctions.net/account/reset-password etc Each service has its own swagger documentation endpoint

Why Won't This Firebase Callable Function Return A Value?

天大地大妈咪最大 提交于 2021-02-07 21:51:02
问题 I have a callable function that should return a value, but the only thing ever returned is null. Below is the current version of the function. I have also tried having a return on the first promise (the original once call), and at the end in another then returning the GUID. It actually returned data in that case, but it returned immediately and the GUID was empty. How can I accomplish my goal and still return the GUID? I don't know when the function is called if I will use a new GUID that I

Why Won't This Firebase Callable Function Return A Value?

早过忘川 提交于 2021-02-07 21:50:36
问题 I have a callable function that should return a value, but the only thing ever returned is null. Below is the current version of the function. I have also tried having a return on the first promise (the original once call), and at the end in another then returning the GUID. It actually returned data in that case, but it returned immediately and the GUID was empty. How can I accomplish my goal and still return the GUID? I don't know when the function is called if I will use a new GUID that I