I found this line of code in the Firebase docs firebase.functions().useEmulator(‘localhost’, 5001) that supposedly points your Vue app to the locally running emulator, but for some reason my project is ignoring said line of code and continues to call the remotely deployed function instead. Here…
Tag: google-cloud-functions
Firebase Cloud Functions – Issues with Promises
When running my Firebase Cloud Function orgNew there seems to be something not working correctly with my promises and the order in which the code is executed. Console log (shortened): My Firebase Cloud Function with some extra code (shortened): All the other functions are not included here because they aren&#…
sendGrid + firebase cloud functions: Email is not sending with Callable functions
I’m new to javascript and I’m trying to send email with the firebase callable functions. the idea is to send code to user email from a cloud function when called from the iOS app. But the thing is, functions can be deployed but I’m not sure what is wrong with my code as it is not sending the…
Why is my function saying that a promise isn’t being handled correctly?
New to Typescript. Wrote this function but I can’t figure out why it’s giving the error below. I commented the 2 lines that the errors are pointing to. 48:9 error Promises must be handled appropriately or explicitly marked as ignored with the void operator @typescript-eslint/no-floating-promises 6…
Change fields of documents in a collection Firestore periodically – Cloud Functions
I have a database structure like this: Posts(collection) -> userID (document) -> Subposts (subcollection) -> document[isVisible: true] We have different userIDs which means that each userID has a subcollection of different posts. I want to set up a cloud function which periodically (every 2 minutes) …
Cloud Function to Update a Record (value = value + newValue) whenever a value chages in Firebase Databse
I am new to Cloud Functions. I have a table ‘drivers’ with having few details. Now I want to write a Firebase Cloud Function which will trigger whenever the value in ‘drivers/{driverId}/history/{rideId}/rating’ is set. Update totalRating (drivers/{driverId}/totalRating) value to oldTot…
Why do i get minus function error in cloud function node js?
I use bignumber in nodejs for cloud functions with firebase.I added BigNumber at the end thinking that it might help. I get this error in Cloud Function Log TypeError: Price.minus is not a function Answer Your typeof Price might be a string. So it needs to be converted to BigNumber. You can use TotalPrice wit…
How to access field on an array in cloud function?
I have this cloud function that creates a new document every time I have a new chat. I am trying to access the values on the messages array, but I got undefined on the console log. here is my document on firebase: I am trying to access the messages with lastMessage = data.messages to create a new document wit…
Firebase Functions and API Keys
Are Firebase functions a safe place to store API keys for a React App? As an example, see the following template for an axios API call in a Firebase Cloud function: cloud function template edit: added text code snippet. The question whether or not it is secure to store the API key directly in this snippet, gi…
How to make multiple fetch requests inside Firebase functions?
I am trying to make 2 fetch requests inside a function which runs periodically. However, I keep on getting this error. Answer Cloud Functions run in a nodejs JavaScript environment. This is very different than browser JavaScript environments. You won’t have access to the fetch() function that browsers p…