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
18,318
questions
320
votes
7
answers
660k
views
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 '...
277
votes
34
answers
265k
views
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-...
230
votes
19
answers
99k
views
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 ...
224
votes
9
answers
119k
views
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 (...
213
votes
5
answers
49k
views
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 ...
203
votes
27
answers
146k
views
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: ...
185
votes
9
answers
74k
views
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 ...
184
votes
7
answers
65k
views
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 ...
157
votes
2
answers
60k
views
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....
129
votes
4
answers
33k
views
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....
128
votes
16
answers
115k
views
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 ...
125
votes
25
answers
72k
views
Stripe Error: No signatures found matching the expected signature for payload
I have a stripe webhook that call a Firebase function. In this function I need to verify that this request comes from Stripe servers. Here is the code :
const functions = require('firebase-functions');...
125
votes
3
answers
61k
views
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.
109
votes
9
answers
56k
views
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?
103
votes
10
answers
65k
views
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 ...
102
votes
4
answers
30k
views
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 ...
94
votes
7
answers
69k
views
Cloud Functions for Firebase - Billing account not configured
I just implemented the new Cloud Functions for Firebase, but there something in the log that bothers me:
Billing account not configured. External network is not accessible and
quotas are severily ...
88
votes
27
answers
34k
views
Firebase Callable Function + CORS
I'm trying to call a callable Cloud Function from my app, but I'm facing CORS issues.
I can't enable Cors since I don't have access to the request and response on the onCall function. This is my ...
88
votes
6
answers
43k
views
How do you setup local environment variables for Cloud Functions for Firebase
I'm using http cloud functions to listen for a request and then return a simple message.
I'm developing cloud functions locally using:
firebase serve --only functions
I've setup some custom ...
86
votes
3
answers
83k
views
firebase deploy --only functions overrides existing functions
Running firebase deploy --only functions deletes the existing functions before creating new ones. Is it possible to modify this behavior to create if not exist, update if exists, no actions if ...
80
votes
8
answers
58k
views
Calling a Cloud Function from another Cloud Function
I am using a Cloud Function to call another Cloud Function on the free spark tier.
Is there a special way to call another Cloud Function? Or do you just use a standard http request?
I have tried ...
80
votes
10
answers
65k
views
Is Cloud Functions in Firebase Free or Not (Cloud Functions deployment requires the pay-as-you-go (Blaze) billing plan)
When i make my first deploy function I can't deploying Because I have Error Asks me to make Upgrade to my account to Blaze I need to Know Can i deploy Function when i use free account??
Output:
i ...
78
votes
14
answers
46k
views
Delete a Document with all Subcollections and Nested Subcollections in Firestore
How can you delete a Document with all it's collections and nested subcollections? (inside the functions environment)
In the RTDB you can ref.child('../someNode).setValue(null) and that completes the ...
76
votes
1
answer
18k
views
How do Callable Cloud Functions compare to HTTP functions?
With the latest Firebase Update callable functions were introduced. My question is how callable functions different than http triggers, and if it is more secure.
I have no expertise in this field, but ...
74
votes
14
answers
51k
views
Error deploying with firebase on npm --prefix $RESOURCE_DIR run lint
I have a fresh install of firebase tools (following this tutorial) and I'm trying to upload my first firebase function. I get this issue with the hello-world example that they initialise when you run ...
70
votes
20
answers
43k
views
Error: Could not load the default credentials (Firebase function to firestore)
I am attempting to write an onCall function for Firebase Cloud Functions that performs advanced querying tasks on a firestore database (i.e. checking a text query up against AutoML natural lang to get ...
69
votes
10
answers
58k
views
Firebase Auth/unauthorized domain. Domain is not authorized
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 ...
67
votes
6
answers
27k
views
Get Cloud Functions code from firebase console which I deployed earlier
I had created firebase functions in nodejs and deployed the code on firebase.
The function was to send an email when the new user is created.
I have lost the code now. Can we pull that code from ...
66
votes
8
answers
41k
views
firebase deploy to custom region (eu-central1)
is there a way to specify the Region/Zone where my firebase functions will be deployed.
Actually i didn't found anything about that in the documentation and my functions are always deployed to us-...
64
votes
5
answers
38k
views
Use custom domain for Google Cloud Function
I can't see any option anywhere to set up a custom domain for my Google Cloud Function when using HTTP Triggers. Seems like a fairly major omission. Is there any way to use a custom domain instead of ...
63
votes
4
answers
89k
views
Firestore Add value to array field
Im trying to use Firebase cloud functions to add the id of a chatroom to the users document in an array field. I cant seem to figure out the way to write to an array field type. here is my cloud ...
62
votes
10
answers
45k
views
Cloud Functions for Firebase killed due to memory limit exceeded
I keep getting a sporadic error from Cloud Functions for Firebase when converting a relatively small image (2mb). When successful, the function only takes about 2000ms or less to finish, and according ...
62
votes
8
answers
18k
views
Are Google Cloud Functions protected from DDoS attacks?
As far as I understand, my Google Cloud Functions are globally accessible. If I want to control access to them, I need to implement authorization as a part of the function itself. Say, I could use ...
61
votes
5
answers
33k
views
Cloud Functions for Firebase - getaddrinfo ENOTFOUND
Trying to make a request to Paypal's API using PayPal-node-SDK
exports.requestPayment = functions.https.onRequest((req, res) => {
return new Promise(function (fullfilled, rejected) {
...
61
votes
6
answers
54k
views
Possible to get static IP address for Google Cloud Functions?
I would like to develop a Google Cloud Function that will subscribe to file changes in a Google Cloud Storage bucket and upload the file to a third party FTP site. This FTP site requires allow-listed ...
60
votes
32
answers
41k
views
Error: Functions did not deploy properly
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error:
Functions did not deploy properly.
60
votes
1
answer
33k
views
Firebase cloud functions using Python?
We are using GCP's Firebase with Firestore for a new mobile app we are developing. As part of this effort we need to deploy a number of cloud functions which will act as Firestore triggers for doing ...
60
votes
4
answers
30k
views
Google Firebase Error(Function returned undefined, expected Promise or value)
I'm developing Server with Firebase.
I had copied Google Developer's Video on Youtube.
It works well, but on log there is an error:
Function returned undefined, expected Promise or value
It says ...
59
votes
5
answers
45k
views
Use firebase cloud function to send POST request to non-google server
I was wondering if its possible to use a firebase cloud function to send a post request to a non-google server (from what I can find I need to be on the blaze plan in order to interact with non google ...
56
votes
10
answers
55k
views
Google Cloud Functions enable CORS?
I just finished the Hello World Google Cloud Functions tutorial and received the following response headers:
Connection → keep-alive
Content-Length → 14
Content-Type → text/plain; charset=utf-8
Date →...
54
votes
10
answers
41k
views
Firebase cloud function deploy error
irregularly my firebase deployment get stuck at this log:
i functions: updating function [FUNCTION NAME]...
After canceling the deploy and retrying it throws the following error message:
⚠ ...
52
votes
6
answers
37k
views
How do you un-deploy Cloud Functions for Firebase?
I was experimenting with Cloud Functions for Firebase and deployed one of the samples in the functions-samples repo and linked it to an existing project using firebase use --add.
Since I was just ...
52
votes
3
answers
17k
views
FieldValue undefined when using functions and Firestore
I have the following function:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const FieldValue = require('firebase-admin').FieldValue;
module.exports = ...
52
votes
3
answers
9k
views
Cloud Functions for Firebase - action on email verified
Im trying to create a Cloud Function trigger that will execute after email has been verified.
In the Cloud Functions samples I could only find examples on triggers for onCreate and onDelete.
Within ...
51
votes
5
answers
24k
views
Running Cloud Functions locally gives error "functions.config() is not available"
Cloud Functions for Firebase was just recently released and I am following the instructions on a fresh install. Here is the "Get Started" page.
I have installed "npm install -g firebase-tools" and ...
50
votes
11
answers
49k
views
Specs satisfying the `Firebase/Functions` dependency were found, but they required a higher minimum deployment target
I was trying to install pod 'Firebase/Functions' but failed with the following error:
`[!] CocoaPods could not find compatible versions for pod "Firebase/Functions":
In Podfile:
Firebase/...
50
votes
6
answers
27k
views
Google Cloud Functions Python Logging issue
I'm not sure how to say this but, I'm feeling like there is something under the hood that was changed by Google without me knowing about it. I used to get my logs from my python Cloud Functions in the ...
50
votes
7
answers
21k
views
Secure Google Cloud Functions http trigger with auth
I am trying out Google Cloud Functions today following this guide: https://cloud.google.com/functions/docs/quickstart
I created a function with an HTTP trigger, and was able to perform a POST request ...
48
votes
1
answer
42k
views
Write temporary files from Google Cloud Function
Can I write to the container's local filesystem from a Google Cloud Function? AWS Lambda allows writing to /tmp:
Q: What if I need scratch space on disk for my AWS Lambda function?
Each Lambda ...
47
votes
3
answers
17k
views
In firebase - How to generate an idToken on the server for testing purposes?
I want to test a a cloud function that creates users.
In normal cases, inside the browser i generate an idToken and i send it to server via headers: Authorization : Bearer etcIdToken
But I want to ...