google-cloud-functions

How can I have WebSockets connect to a Google Cloud Function?

白昼怎懂夜的黑 提交于 2021-02-05 07:12:05
问题 I have a WebSocket that I'm subscribing to and when an event comes in, I want to trigger a Google Cloud Function. Is this possible? For example, I'm listening to https://alpaca.markets/docs/api-documentation/api-v2/streaming/ And whenever I get trade_updates , I want to run a function on Google cloud Functions 回答1: All trigger types for Cloud Functions are listed here: https://cloud.google.com/functions/docs/calling Web Sockets are not directly supported as a trigger type. The closest I can

How to return with a specific status in a Python Google Cloud Function

≡放荡痞女 提交于 2021-02-05 05:24:25
问题 I notice that I can raise or return, producing 500 or 200 responses. for example: def random(request): coin = [true, false] if random.choice(coin): succeed() else: fail() def succeed(): return '{ "status": "success!"}' def fail(): raise Exception("failure") something roughly like that will produce either a 500 or a 200 response. But it doesn't, for example, let me raise a 422 error with a body. Can I do that? 回答1: Under the hood, Cloud Functions is just using Flask, so you can return anything

All nameservers failed to answer UDP port 53 Google cloud functions python 3.7 atlas mongodb

只愿长相守 提交于 2021-02-04 16:25:10
问题 i can connect locally to my mongodb server with the address 0.0.0.0/0. However, when I deploy my code to the cloud I get the error deploy to google cloud function. google cloud function with python 3.7 (beta) atlas mongo db python lib: -pymongo -dnspython Error: function crashed. Details: All nameservers failed to answer the query _mongodb._tcp.**-***.gcp.mongodb.net. IN SRV: Server ***.***.***.*** UDP port 53 answered SERVFAIL Traceback (most recent call last): File "/env/local/lib/python3.7

How to read Environmental Variables from .env file in Firebase?

一曲冷凌霜 提交于 2021-02-04 08:28:39
问题 The easiest, multiplaform way to store environmental variables is by using .env file in the root of our project. Now, the problem I'm facing is related to Firebase, more precisely Cloud Functions for Firebase. For all environmental variables accessed via process.env.SOME_VARIABLE I'm getting undefined , until the time of copying .env file to my deployment folder. In this case it's the default's functions , only then it works. The question: is there any way to do so without duplication of the

Unable to deploy google cloud functions

老子叫甜甜 提交于 2021-02-04 07:25:06
问题 I tried to deploy a cloud function on the google cloud platform using the my console. The command I used was, gcloud functions deploy function_name --runtime=python37 --memory=1024MB --region=asia-northeast1 --allow-unauthenticated --trigger-http But I am getting this error, ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: could not resolve storage source: googleapi: Error 404: Not Found, notFound I tried googling around but it seems like no one had faced this

Google Cloud Function Authorization Failing

微笑、不失礼 提交于 2021-02-04 06:01:32
问题 I have a Private Google Cloud Function. So I want to Authenticate to the Cloud Function with Authorization: Bearer token Header. But I'm getting 401 Unauthorized as the response. I created the private Cloud Function using: gcloud beta functions deploy MyFunction --runtime go111 --trigger-http --memory 128 --region us-central1 --source gs://bucketname/code.zip I created a service account and assigned it permission to access the cloud function: gcloud beta functions add-iam-policy-binding

Google Cloud Function Authorization Failing

◇◆丶佛笑我妖孽 提交于 2021-02-04 06:00:44
问题 I have a Private Google Cloud Function. So I want to Authenticate to the Cloud Function with Authorization: Bearer token Header. But I'm getting 401 Unauthorized as the response. I created the private Cloud Function using: gcloud beta functions deploy MyFunction --runtime go111 --trigger-http --memory 128 --region us-central1 --source gs://bucketname/code.zip I created a service account and assigned it permission to access the cloud function: gcloud beta functions add-iam-policy-binding

Google Cloud Function Authorization Failing

自古美人都是妖i 提交于 2021-02-04 06:00:04
问题 I have a Private Google Cloud Function. So I want to Authenticate to the Cloud Function with Authorization: Bearer token Header. But I'm getting 401 Unauthorized as the response. I created the private Cloud Function using: gcloud beta functions deploy MyFunction --runtime go111 --trigger-http --memory 128 --region us-central1 --source gs://bucketname/code.zip I created a service account and assigned it permission to access the cloud function: gcloud beta functions add-iam-policy-binding

Google Cloud Function Authorization Failing

末鹿安然 提交于 2021-02-04 06:00:01
问题 I have a Private Google Cloud Function. So I want to Authenticate to the Cloud Function with Authorization: Bearer token Header. But I'm getting 401 Unauthorized as the response. I created the private Cloud Function using: gcloud beta functions deploy MyFunction --runtime go111 --trigger-http --memory 128 --region us-central1 --source gs://bucketname/code.zip I created a service account and assigned it permission to access the cloud function: gcloud beta functions add-iam-policy-binding

Firebase functions invoke in next 20s

不羁岁月 提交于 2021-01-29 21:52:24
问题 So, I'm making multiplayer mobile game using Xamarin and Firebase. In game there are many moment when I'm letting players decide what to do and send their decision to the server (by putting decision enum in player-specific Firebase database node). Decision is time limited (short time, no longer than 20s). I set listener to that specific node in my Firebase functions to check if all player decided or player decision comes after time deadline, but I need to deal with case when: some players