google-cloud-functions

Is there a way to restrict public access from firebase callable could functions

天大地大妈咪最大 提交于 2020-07-27 03:25:14
问题 Firebase callable cloud functions can be accessed via client sdks, which requires a valid auth context for authentication and authorization. But and at the same time it is exposed as an HTTP endpoint, thus can be called but will receive an unauthorized response. My questions is, is there a way to completely restrict public access for a callable cloud functions? since firebase will charge cloud functions based on function executions. Even to return an unauthorized response, the request has

What exactly is “source” in the context of Firebase rewrites?

落花浮王杯 提交于 2020-07-23 16:11:23
问题 I've read the Firebase documents and watched other tutorials multiple times and none of them explicitly explained what source was. so in Layman's terms, what exactly is source in the context of the code below? "hosting": { // ... // Add the "rewrites" attribute within "hosting" "rewrites": [ { "source": "/bigben", "function": "bigben" } ] } 回答1: By declaring a rewrite , as follows "rewrites": [ { "source": "/bigben", "function": "bigben" } ] you actually "direct hosting requests to your

What exactly is “source” in the context of Firebase rewrites?

早过忘川 提交于 2020-07-23 16:08:43
问题 I've read the Firebase documents and watched other tutorials multiple times and none of them explicitly explained what source was. so in Layman's terms, what exactly is source in the context of the code below? "hosting": { // ... // Add the "rewrites" attribute within "hosting" "rewrites": [ { "source": "/bigben", "function": "bigben" } ] } 回答1: By declaring a rewrite , as follows "rewrites": [ { "source": "/bigben", "function": "bigben" } ] you actually "direct hosting requests to your

What exactly is “source” in the context of Firebase rewrites?

前提是你 提交于 2020-07-23 16:05:51
问题 I've read the Firebase documents and watched other tutorials multiple times and none of them explicitly explained what source was. so in Layman's terms, what exactly is source in the context of the code below? "hosting": { // ... // Add the "rewrites" attribute within "hosting" "rewrites": [ { "source": "/bigben", "function": "bigben" } ] } 回答1: By declaring a rewrite , as follows "rewrites": [ { "source": "/bigben", "function": "bigben" } ] you actually "direct hosting requests to your

Asynchronous Firebase query to response

一世执手 提交于 2020-07-23 08:36:06
问题 I'm trying to get all documents from a firebase collection, create a list and return it on request with a Cloud Function, but I'm struggling with the asynchronous nature of JavaScript. Here's my code so far: firebase.initializeApp(firebaseConfig); const db = firebase.firestore(); const items = ""; async function buildItems() { db.collection("reminders").get().then((QuerySnapshot) => { QuerySnapshot.forEach((item) => { items.concat("<li>" + item.data().name + "</li>"); console.log(items); });

Asynchronous Firebase query to response

会有一股神秘感。 提交于 2020-07-23 08:35:07
问题 I'm trying to get all documents from a firebase collection, create a list and return it on request with a Cloud Function, but I'm struggling with the asynchronous nature of JavaScript. Here's my code so far: firebase.initializeApp(firebaseConfig); const db = firebase.firestore(); const items = ""; async function buildItems() { db.collection("reminders").get().then((QuerySnapshot) => { QuerySnapshot.forEach((item) => { items.concat("<li>" + item.data().name + "</li>"); console.log(items); });

Asynchronous Firebase query to response

自古美人都是妖i 提交于 2020-07-23 08:34:28
问题 I'm trying to get all documents from a firebase collection, create a list and return it on request with a Cloud Function, but I'm struggling with the asynchronous nature of JavaScript. Here's my code so far: firebase.initializeApp(firebaseConfig); const db = firebase.firestore(); const items = ""; async function buildItems() { db.collection("reminders").get().then((QuerySnapshot) => { QuerySnapshot.forEach((item) => { items.concat("<li>" + item.data().name + "</li>"); console.log(items); });

getSignedUrl when using cloud functions

こ雲淡風輕ζ 提交于 2020-07-23 06:45:07
问题 I am trying to get image url so that I can pass it as src in my html. I created functions and would like to send the url in response. I tried the below but I keep getting Error: Cannot sign data without client_email . import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; export const getPicURL = functions.https.onRequest( (request, response) => { const storageBucket = admin .storage() .bucket('gs://my-app.appspot.com'); const fileName = 'my-app/pic1.jpg';

getSignedUrl when using cloud functions

南楼画角 提交于 2020-07-23 06:43:20
问题 I am trying to get image url so that I can pass it as src in my html. I created functions and would like to send the url in response. I tried the below but I keep getting Error: Cannot sign data without client_email . import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; export const getPicURL = functions.https.onRequest( (request, response) => { const storageBucket = admin .storage() .bucket('gs://my-app.appspot.com'); const fileName = 'my-app/pic1.jpg';

Use of Service account credentials when using Cloud Functions Shell

谁说我不能喝 提交于 2020-07-22 21:32:35
问题 I've just migrated to Cloud Functions 1.0 and am trying out Cloud Functions shell/emulator to run functions locally (using instructions at https://firebase.google.com/docs/functions/local-emulator) One of the functions is using code below to upload a file to cloud storage and then then generate url for it....but am getting following error: SigningError: Cannot sign data without client_email . const bucket = gcs.bucket(bucketName); bucket.upload(localFilePath, {destination: destinationPath})