google-cloud-functions

Unhandled Error gets thrown in Firebase Cloud Functions

你离开我真会死。 提交于 2020-08-19 17:40:25
问题 I'm using Firebase Cloud Functions, and in one of my projects I have a simple function that looks like the following: exports.responseGiven = functions.https.onCall(async (data, context) => { if (!context.auth) { throw new functions.https.HttpsError( 'permission-denied', 'Must be an user to execute this action' ); } const studentPath = data.studentPath; const eventPath = data.eventPath; const isUpdating = data.isUpdating; const studentDoc = await admin.firestore().collection('students').doc(

Unhandled Error gets thrown in Firebase Cloud Functions

ぐ巨炮叔叔 提交于 2020-08-19 17:40:18
问题 I'm using Firebase Cloud Functions, and in one of my projects I have a simple function that looks like the following: exports.responseGiven = functions.https.onCall(async (data, context) => { if (!context.auth) { throw new functions.https.HttpsError( 'permission-denied', 'Must be an user to execute this action' ); } const studentPath = data.studentPath; const eventPath = data.eventPath; const isUpdating = data.isUpdating; const studentDoc = await admin.firestore().collection('students').doc(

Firebase function onCall, response: Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail

。_饼干妹妹 提交于 2020-08-11 02:49:30
问题 I try to call my test function from local project. But all time when i call, i take 401 error. I don't know what trouble here, in front end i have init app with api key, in firebase function i have admin.credential.applicationDefault() ; I tried to pass admin.credential.cer(apiConfig) , but this don't help to. I also have Environment variable GOOGLE_APPLICATION_CREDENTIALS , with path to my config. Dependencies "firebase-admin": "~7.0.0", "firebase-functions": "^2.2.0", "firebase-functions

Showing “unexpected token admin” error although admin is declared

风流意气都作罢 提交于 2020-08-09 09:31:44
问题 I'm trying to do some sequential asynchronous operation. But getting error: Parsing error: Unexpected token admin Although I've declared this variable. Here is my code const admin = require('firebase-admin') module.exports = { notificationCount: async (change, context) => { countRef.collection("notification").doc(context.params.reqID).get().then((requestDoc) => { console.log("Request Info " + requestDoc.data().reqUserName) return requestDoc.data(); }).then((requestDocData) => { const token =

Insert event in google calendar using service account with Nodejs

偶尔善良 提交于 2020-08-09 08:13:18
问题 I can't insert an event using Nodejs with service account. The service account Email is already added into the account with the permission make changes to event My nodejs code is running on google cloud functions Here is my code: const { google } = require('googleapis'); var event = { 'summary': 'Google I/O 2015', 'location': '800 Howard St., San Francisco, CA 94103', 'description': 'A chance to hear more about Google\'s developer products.', 'start': { 'dateTime': '2020-02-10T13:00:00-05:00'

Firebase Can't Deploy

你。 提交于 2020-08-08 07:01:32
问题 I have a firebase project I've been maintaining for months and haven't had any problems with. I've tried running firebase deploy multiple times to no avail. I've googled it and searched on SO, github, and others, found these links, none of which worked. I've tried updating firebase tools, uninstalling and reinstalling, and everything between. Please don't blindly flag as duplicate without reading. The first line of my error looks like this: \AppData\Roaming\npm\node_modules\firebase-tools

cloud functions python to access Datastore

陌路散爱 提交于 2020-08-08 06:42:24
问题 I am looking for a tutorial or document on how to access datastore using cloud functions (python). However, it seems there is only tutorial for nodejs. https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/functions/datastore Can anybody help me out? Thanks 回答1: There are no special setup needed to access datastore from cloud functions in python. You just need to add google-cloud-datastore into requirements.txt and use datastore client as usual. requirements.txt # Function

An unknown error has occurred in Cloud Function: GCP Python

一曲冷凌霜 提交于 2020-08-08 05:18:30
问题 Log Viewer Unknown Error Image I am running into an Unknown Error while executing a Cloud Function in GCP (Python). Steps: Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. It is executing successfully and files are stored in

An unknown error has occurred in Cloud Function: GCP Python

二次信任 提交于 2020-08-08 05:17:05
问题 Log Viewer Unknown Error Image I am running into an Unknown Error while executing a Cloud Function in GCP (Python). Steps: Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. Running Cloud Function to retrieve the data from BigQuery DataStore and save the CSV file in GCP Storage. It is executing successfully and files are stored in

How to impersonate the database authentication from Firebase Cloud Function with admin privileges?

假装没事ソ 提交于 2020-08-08 04:31:25
问题 I have a set of Firebase Functions that works as an API for an application. These Firebase Functions connect to the database with admin privileges as this: const serviceAccount = require(`./config/xxx-firebase-adminsdk.json`); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: DATABASE_URL, }); I was able to create a custom token and I'm receiving/decoding it in the server but I cannot make use of the security rules because the Firebase function is