google-cloud-functions

Python Google Cloud Function Logging Severity and Duplicates

我怕爱的太早我们不能终老 提交于 2020-02-23 10:24:21
问题 I'm working on a simple Google Cloud Function that runs in the Python runtime and I want some simple logging from the Python program to Stackdriver Logging. Based on Google's startup guide, this should be straighforward https://cloud.google.com/logging/docs/setup/python I set up a simple test function to isolate the logging issues I'm seeing import google.cloud.logging def logging_test_background(data, context): logging_client = google.cloud.logging.Client() logging_client.setup_logging()

Firebase Cloud Functions Firestore Trigger produces: Error: 7 PERMISSION_DENIED: Missing or insufficient permissions

别来无恙 提交于 2020-02-20 04:49:59
问题 I'm trying to use a Firebase Cloud Function to update a document within my Firestore database, when one of my documents has been updated using a trigger. The trigger is called and working fine, but when I'm using the firebase admin instance to get the other document which I want to update, I'm getting the following error. Error: 7 PERMISSION_DENIED: Missing or insufficient permissions. at Object.exports.createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/common.js

Firebase Cloud Functions Firestore Trigger produces: Error: 7 PERMISSION_DENIED: Missing or insufficient permissions

青春壹個敷衍的年華 提交于 2020-02-20 04:49:46
问题 I'm trying to use a Firebase Cloud Function to update a document within my Firestore database, when one of my documents has been updated using a trigger. The trigger is called and working fine, but when I'm using the firebase admin instance to get the other document which I want to update, I'm getting the following error. Error: 7 PERMISSION_DENIED: Missing or insufficient permissions. at Object.exports.createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/common.js

Firebase Auth/unauthorized domain. Domain is not authorized

半腔热情 提交于 2020-02-19 10:11:12
问题 I am trying to run this sample firebase project, but I keep getting this error in the browser console. Lf {code: "auth/unauthorized-domain", message: "This domain (mail-demo-fcm.firebaseapp.com) is not…se console -> Auth section -> Sign in method tab."} code: "auth/unauthorized-domain" message: "This domain (mail-demo-fcm.firebaseapp.com) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab." I have

Disabling Billing on Google Cloud Using Google Cloud Function (Keyerror: 'data')

青春壹個敷衍的年華 提交于 2020-02-16 05:29:25
问题 I am attempting to write a Google Cloud Function to set caps to disable usage above a certain limit. I followed the instructions here: https://cloud.google.com/billing/docs/how-to/notify#cap_disable_billing_to_stop_usage. This is what my cloud function looks like (I am just copying and pasting from the Google Cloud docs page linked above): import base64 import json import os from googleapiclient import discovery from oauth2client.client import GoogleCredentials PROJECT_ID = os.getenv('GCP

Disabling Billing on Google Cloud Using Google Cloud Function (Keyerror: 'data')

一曲冷凌霜 提交于 2020-02-16 05:29:21
问题 I am attempting to write a Google Cloud Function to set caps to disable usage above a certain limit. I followed the instructions here: https://cloud.google.com/billing/docs/how-to/notify#cap_disable_billing_to_stop_usage. This is what my cloud function looks like (I am just copying and pasting from the Google Cloud docs page linked above): import base64 import json import os from googleapiclient import discovery from oauth2client.client import GoogleCredentials PROJECT_ID = os.getenv('GCP

Running URL Requests in Parallel with Flask

爱⌒轻易说出口 提交于 2020-02-07 03:08:48
问题 asyncio is still relatively new for me. I am starting with the basics - simple HTTP hello world - just making approximately 40 parallel GET requests and fetching the first 400 characters of the HTTP responses using Flask ("parallel" function is invoked by request). It is running on python 3.7. The Traceback is showing errors I don't understand. Which "Constructor parameter should be str" is this referring to? How should I proceed? This is the entire code of the app: import aiohttp import

What happens to async calls in completed firebase functions?

微笑、不失礼 提交于 2020-02-07 02:35:26
问题 If I choose not to wait for an async call to complete inside a firebase function, what happens to the async call when the function completes? On what thread does it continue, does it still run within the function's runtimeOpts and how does this affect usage? import * as firebase from 'firebase'; import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; exports.action = functions.https.onRequest((req, res) => { admin.database().ref('action').add({ 1: 2 }); res

How can I change a VM/Instance label with GCP Cloud Function using node.js?

点点圈 提交于 2020-02-06 07:40:46
问题 I am testing a Cloud Function in GCP and I want to modify labels of my compute instance with Cloud Function i.e. change label "status=active" to "status=tobedeleted". Is there a way to do it with Cloud Function and node.js ? Looks as if the method compute.instances.setLabels requires additional libraries ? I already created Cloud Function to stop/start instances. Here is the error : resource: {…} severity: "ERROR" textPayload: "{ Error: Login Required at Gaxios.request (/srv/node_modules

Upgrading to Cloud Functions v1.0 and I broke everything

好久不见. 提交于 2020-02-03 10:00:27
问题 Trying to follow the instructions on this page and I can't figure out how to simply get to the data in the DocumentSnapshot. They do not really explain updating onCreate, except to say it is the same as onDelete, and I can't get that to work. exports.mFoo = functions.firestore .document('foos/{key}') .onCreate((snap, context) => { const bar = snap.data(); // <-- DOESN'T WORK console.log(bar); // <-- DOESN'T WORK return Promise; }); I get the following error: TypeError: snap.data is not a