google-cloud-functions

Firebase Functions, admin.database().ref(…).get() is not a function

无人久伴 提交于 2021-01-27 14:16:23
问题 I am working on an Android Application and am using firebase as the back end for it. I am trying to get a notification system working that relies on listening to changes in the database. Having problems though as I am getting the following error. Wondered if anyone would be able to help, any extra code can be supplied. Firebase Function 'use-strict' const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase);

Unhandled Rejection in Google Cloud Functions

北城余情 提交于 2021-01-27 13:47:29
问题 I got the following cloud function which works great. It's listening for an update in the real-time database and update Firestore accordingly. Everything is fine, except when my user does not exist yet my Firestore database. This where I need to deal with Unhandled rejection that I see in the Google Cloud Functions log. So see below, in the shortened version of the function, for my db.collection("users").where("email", "==", email).get() how to stop the function to move forward and prevent

Firebase Cloud Function - null user.displayName onCreate

人盡茶涼 提交于 2021-01-27 13:16:22
问题 I'm trying to write a function that will send a welcome email on user creation. I followed along to this tutorial, which says that one can access the newly created user's displayName with user.displayName , though it keeps returning null for me. I realized that the probable reason that this happens (correct me if I'm wrong here) is that registration and setting the user's displayName happens in two separate steps client-side and therefore when onCreate is triggered, user.displayName will

Using wildcards in firestore get query

♀尐吖头ヾ 提交于 2021-01-27 12:50:48
问题 I want to create a cloud function in firebase that gets triggered whenever a user logs in for the first time. The function needs to add the UID from the authentication of the specific user to a specific, already existing document in firestore. The problem is that the UID needs to be added to a document of which I do not know the location. The code I have right now doesn't completely do that, but this is the part where it goes wrong. The database looks like this when simplified organisations

How to setup a duplicate project in firebase? [duplicate]

南笙酒味 提交于 2021-01-27 12:05:10
问题 This question already has answers here : How to clone an existing Firebase project data to another new project? (3 answers) Closed 1 year ago . I would like to create a duplicate project in firebase so that I dont have to go through the hassle of adding the firebase functions and notifications etc. If I could I would just delete all auth users so that its ready for the actual app but I am unable to do that. So How can I set up a duplicate project but without all the authenticated test users?

Defining a Firestore query by comparing two document's fields values

妖精的绣舞 提交于 2021-01-27 12:01:39
问题 I'm having my first steps with Cloud Firestore, and I am stuck on this one. I'm looking for a where query to return me values that are >= the limit. [{ 'limit': 100, 'value': 200 }, { 'limit': 50, 'value: 50, }, { 'limit': 95, 'value': 90, }] I am using the Firebase Admin Python SDK in a Cloud Function. Any hints? 回答1: As Alex has explained, there is no way to compare two document's fields values when executing a query with Firestore. One possible approach, would be to save the result of the

How to setup a duplicate project in firebase? [duplicate]

谁说我不能喝 提交于 2021-01-27 11:57:29
问题 This question already has answers here : How to clone an existing Firebase project data to another new project? (3 answers) Closed 1 year ago . I would like to create a duplicate project in firebase so that I dont have to go through the hassle of adding the firebase functions and notifications etc. If I could I would just delete all auth users so that its ready for the actual app but I am unable to do that. So How can I set up a duplicate project but without all the authenticated test users?

Firebase-Hosted Cloud Function retrying on any request that takes 60s, even when timeout is >60s

蓝咒 提交于 2021-01-27 10:42:11
问题 I have a vanilla cloud function that takes 60 seconds and then returns status 200 with a simple JSON object. The timeout for the function is set to 150s. When testing locally, and when running the function via it's cloudfunctions.net address, the function completes at 60s and the 200 response and body are correctly delivered to the client. So far so good. Here's the kicker -- If I run the exact same function proxied through firebase hosting (setup via a "target" inside firebase.json),

Get “HTTP Error: 404, Method not found.” when running “firebase deploy --only functions” on Firebase Cloud Functions

…衆ロ難τιáo~ 提交于 2021-01-27 07:08:11
问题 I'm stuck with this problem since hours and I thought that maybe one of you encountered it before. I get Error: HTTP Error: 404, Method not found. when I run firebase deploy --only functions so I'm unable to deploy my last updates. This happens with ALL my Firebase Cloud Functions projects This does not happen with my Firebase Hostings Here's what I get when I add --debug : firebase deploy --only functions:onBookingCreated --debug [2020-08-25T15:18:37.029Z] -----------------------------------

Firebase Admin SDK apply action code for email verification

戏子无情 提交于 2021-01-27 05:48:32
问题 The Firebase Customize the Email Action Handler guide gives an example of verifying a user's email address on a custom URL to a site hosted through Firebase. However, I want the custom URL to point to a Firebase cloud function endpoint URL and use admin SDK to verify the oob code instead. But there is no such function as applyActionCode for the admin.auth() . Is verifying email through a hosted site using javascript the only way to go? I don't really want to expose the code to the browser.