Questions tagged [google-cloud-functions]

Google Cloud Functions is a lightweight, event-based, asynchronous compute solution that allows you to create small, single-purpose functions written in Node.js, Python or Go that respond to cloud events without the need to manage a server or a runtime environment.

Google Cloud Functions is a lightweight, event-based, asynchronous compute solution that allows you to create small, single-purpose functions written in or that respond to cloud events without the need to manage a server or a runtime environment.

Related tags:

17585 questions
294
votes
6 answers

How can I solve the error 'TS2532: Object is possibly 'undefined'?

I'm trying to rebuild a web app example that uses Firebase Cloud Functions and Firestore. When deploying a function I get the following error: src/index.ts:45:18 - error TS2532: Object is possibly 'undefined'. 45 const data =…
266
votes
34 answers

Enabling CORS in Cloud Functions for Firebase

I'm currently learning how to use new Cloud Functions for Firebase and the problem I'm having is that I can't access the function I wrote through an AJAX request. I get the "No 'Access-Control-Allow-Origin'" error. Here's an example of the function…
228
votes
19 answers

How do I structure Cloud Functions for Firebase to deploy multiple functions from multiple files?

I would like to create multiple Cloud Functions for Firebase and deploy them all at the same time from one project. I would also like to separate each function into a separate file. Currently I can create multiple functions if I put them both in…
217
votes
9 answers

How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users?

With the new firebase cloud function I've decided to move some of my HTTP endpoint to firebase. Everything works great... But i have the following issue. I have two endpoints build by HTTP Triggers (Cloud Functions) An API endpoint to create users…
197
votes
27 answers

Get Download URL from file uploaded with Cloud Functions for Firebase

After uploading a file in Firebase Storage with Functions for Firebase, I'd like to get the download url of the file. I have this : ... return bucket .upload(fromFilePath, {destination: toFilePath}) .then((err, file) => { // Get…
Valentin
  • 5,379
  • 7
  • 36
  • 50
190
votes
4 answers

HTTP Error: 401 while setting up firebase cloud functions for android project

I`m trying to set up firebase functions, but I get an error after running firebase init. Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.…
M.Ali
  • 8,815
  • 5
  • 24
  • 42
183
votes
7 answers

Firebase cloud functions is very slow

We're working on an application that uses the new firebase cloud functions. What currently is happening is that a transaction is put in the queue node. And then the function removes that node and puts it in the correct node. This has been…
175
votes
7 answers

How to deploy some functions to Cloud Functions for Firebase without affecting some other functions?

When I run firebase deploy --only functions it reads the index.js file and updates all functions exported from that file. If on the previous deploy there was a function named a, and in the current deploy there is no such function, a will be deleted.…
Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228
144
votes
2 answers

Firebase Cloud Functions: Difference between onRequest and onCall

Going through the docs, I encountered: ...you can call functions directly with an HTTP request or a call from the client. ~ source there (link in the quote) is a mention about functions.https.onCall. But in the tutorial here, another function…
Qwerty
  • 29,062
  • 22
  • 108
  • 136
124
votes
3 answers

Cloud Functions for Firebase trigger on time?

I am looking for a way to schedule Cloud Functions for Firebase or in other words trigger them on a specific time.
123
votes
4 answers

What is the difference between Cloud Functions and Firebase Functions?

Cloud Functions and Firebase Functions (or "Cloud Functions for Firebase") both look the same. Please describe the use case of each. Both use HTTP functions. In the Cloud Functions: exports.helloHttp = function helloHttp (req, res) { …
114
votes
15 answers

Firebase cloud function "Your client does not have permission to get URL /200 from this server"

I just made a firebase cloud function : exports.deleteAfterSevenDays = functions.https.onRequest((req, res) => {... I deployed the function and got a function URL. When I request this url from my browser I get the following message : "Error:…
Alex9494
  • 1,588
  • 3
  • 12
  • 22
101
votes
4 answers

When to choose App Engine over Cloud Functions?

Sorry, if this is a naive question, but i've watched bunch of talks from google's staff and still don't understand why on earth i would use AE instead of CF? If i understood it correctly, the whole concept of both of these services is to build…
97
votes
10 answers

How do I get the server timestamp in Cloud Functions for Firebase?

I know you can pull the server timestamp in web, ios, and android - but what about the new Cloud Functions for Firebase? I can't figure out how to get the server timestamp there? Use case is me wanting to timestamp an email when it arrives. On web…
96
votes
9 answers

How to import data from cloud firestore to the local emulator?

I want to be able to run cloud functions locally and debug against a copy from the production data. Is there a way to copy the data that is online to the local firestore emulator?
1
2 3
99 100