google-cloud-functions

TypeError: Cannot read property 'toDate' of undefined

依然范特西╮ 提交于 2020-07-22 10:09:28
问题 I have a firebase project, I am getting the below error log when running a firebase function, below are the error log and the code. the error is Cannot read property 'toDate' of undefined , converting a admin.firestore.Timestamp to Date format. How to solve this error Error Log: Unhandled error TypeError: Cannot read property 'toDate' of undefined at new PostTable (/srv/lib/index.js:9:34) at cal.then.docCollection (/srv/lib/index.js:69:39) at <anonymous> at process._tickDomainCallback

Flutter Firebase Cloud function can not be called

♀尐吖头ヾ 提交于 2020-07-22 05:42:26
问题 I am getting an error whilst using Firebase Cloud Functions when I try to call a callable function from Flutter. flutter: caught generic exception flutter: PlatformException(functionsError, Firebase function failed with exception., {message: NOT FOUND, code: NOT_FOUND}) Here is how I try to call the cloud function with using cloud_functions: ^0.4.2+3 import 'package:cloud_functions/cloud_functions.dart'; _check(String id) async { HttpsCallable callable = CloudFunctions.instance

FirebaseError: invalid stream token

≯℡__Kan透↙ 提交于 2020-07-22 05:21:50
问题 After changing a cloud function I’m getting the following error for any write operation to my database: FirebaseError: invalid stream token . After changing the functions back and redeploying, the error still remains. I was unable to find any reference to this error in Firebase docs. Anyone know what this is about? 回答1: I "solved" this. For anyone else who runs into the error: > rm package-lock.json > rm -rf node-modules/ > npm install Would still be nice to have a reference to this somewhere

FirebaseError: invalid stream token

狂风中的少年 提交于 2020-07-22 05:21:33
问题 After changing a cloud function I’m getting the following error for any write operation to my database: FirebaseError: invalid stream token . After changing the functions back and redeploying, the error still remains. I was unable to find any reference to this error in Firebase docs. Anyone know what this is about? 回答1: I "solved" this. For anyone else who runs into the error: > rm package-lock.json > rm -rf node-modules/ > npm install Would still be nice to have a reference to this somewhere

Google Cloud Function not created with Private access

。_饼干妹妹 提交于 2020-07-21 03:33:50
问题 I'm creating Google Cloud HTTP Function using my python script as follows: gcloud beta functions deploy " + function_name + " --runtime go111 --trigger-http --memory 128 --region " + cloud_region + " --source " + function_path + " --service-account " + my_service_account Allow unauthenticated invocations of new function [ExecuteFunctionTest]? (y/N)? N WARNING: Function created with default IAM policy. To enable unauthorized access consider "gcloud alpha functions add-iam-policy-binding

Google Cloud Function not created with Private access

对着背影说爱祢 提交于 2020-07-21 03:33:07
问题 I'm creating Google Cloud HTTP Function using my python script as follows: gcloud beta functions deploy " + function_name + " --runtime go111 --trigger-http --memory 128 --region " + cloud_region + " --source " + function_path + " --service-account " + my_service_account Allow unauthenticated invocations of new function [ExecuteFunctionTest]? (y/N)? N WARNING: Function created with default IAM policy. To enable unauthorized access consider "gcloud alpha functions add-iam-policy-binding

Firebase Functions HTTPS 403 Forbidden

北慕城南 提交于 2020-07-20 07:50:30
问题 I built a Firebase HTTP Event function with Node and Express. The function is working, but when I invoke the function on the client side I get 403 Forbidden . The first time I invoked the function I was asked to sign in with a Google account. I signed in with the same account I use for Firebase, but when I invoked the function I got: Screenshot of 403 error I looked at the use roles on Google cloud platform and the permission to invoke the function is set to allUsers . I signed out and back

Firestore query for loop with multiple values

独自空忆成欢 提交于 2020-07-19 05:58:26
问题 I am attempting to retrieve a number of Firestore documents using data held in a string. The idea is that for each value in the array, i'd use Firestore query to retrieve the document matching that query and push it to another array. I am having a few issues achieving this. So far i've tried: exports.findMultipleItems = functions.https.onRequest((request, response) => { var list = ["item1", "item2", "item3", "item4"]; var outputList = []; for (var i = 0; i < list.length; i++) { console.log(

google cloud function python CORS error No 'Access-Control-Allow-Origin' header is present on the requested resource.

℡╲_俬逩灬. 提交于 2020-07-19 04:13:19
问题 Ive followed instructions at https://cloud.google.com/functions/docs/writing/http#functions_http_cors-python So my code has this at the end # Set CORS headers for the preflight request if request.method == 'OPTIONS': # Allows GET requests from any origin with the Content-Type # header and caches preflight response for an 3600s headers = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Allow-Headers': 'Content-Type', 'Access-Control-Max-Age': '3600'

Flutter web - Upload Image File to Firebase Storage

假装没事ソ 提交于 2020-07-18 04:45:08
问题 On flutter web, I pick an image file from the computer and get a File image object. Then I want to upload it to Firebase Storage. For Android and iOS versions of the app I was using a Firebase Cloud Function and an http multipart request. It worked, but for the web version of the app it doesn't. So, How can I upload an html image file to Firebase Storage, either directly or through a Cloud Function? 回答1: Finally I managed to find a solution to this issue. To achieve this I needed to install