google-cloud-functions

Unreliable Google Firebase transactions

亡梦爱人 提交于 2020-03-25 18:21:29
问题 In my (greatly simplified) model I have users, accounts and account_types. Each user can have multiple accounts of each account_type. When an account of type TT is created I'm updating the "users" field of that object so it keeps the users which have accounts of that types, and the number of such accounts they have. users: { some fields }, accounts: { userID: UU, type: TT }, account_type: users: { UU: 31 } } I use the onCreate and onDelete cloud triggers for accounts to update the account

Unreliable Google Firebase transactions

亡梦爱人 提交于 2020-03-25 18:21:17
问题 In my (greatly simplified) model I have users, accounts and account_types. Each user can have multiple accounts of each account_type. When an account of type TT is created I'm updating the "users" field of that object so it keeps the users which have accounts of that types, and the number of such accounts they have. users: { some fields }, accounts: { userID: UU, type: TT }, account_type: users: { UU: 31 } } I use the onCreate and onDelete cloud triggers for accounts to update the account

Expire pending queued items

杀马特。学长 韩版系。学妹 提交于 2020-03-25 13:44:03
问题 I am building a site that users can buy a limited number of event tickets. The users can go on my site and get the tickets. Once they have available tickets in their cart, they will have a set amount of time(5 minutes) to complete the transaction. If they complete the transaction before the timer is up the tickets are permanently removed from the database availability. If they don't complete the transaction before the 5 minutes then their allotment gets put back into the queue for the public

Expire pending queued items

爱⌒轻易说出口 提交于 2020-03-25 13:43:42
问题 I am building a site that users can buy a limited number of event tickets. The users can go on my site and get the tickets. Once they have available tickets in their cart, they will have a set amount of time(5 minutes) to complete the transaction. If they complete the transaction before the timer is up the tickets are permanently removed from the database availability. If they don't complete the transaction before the 5 minutes then their allotment gets put back into the queue for the public

how to handle root path request with node.js on firebase hosting?

左心房为你撑大大i 提交于 2020-03-25 08:45:23
问题 I'm developing web system using firebase hosting + functions. Inspite of specifying rewrite rules on firebase.json, a part of routing doesn't work. root/  ├ functions/  │ ├index.js  │ ├routes/  │ │ └ index.js  │ └views/  │ ├ index.jade  │ └ sub.jade  └ public/ └index.html // this is created by default. I don't want to use this. This is my firebase.json "rewrites": [{ "source": "**", "function": "app" }], And this is node.js code. router.get('/', function(req, res, next) { res.render('index');

Is there any way to utilize Cloud Function auth env vars to interact with Google Drive?

ⅰ亾dé卋堺 提交于 2020-03-23 07:47:22
问题 I'm deploying a Cloud Function which interacts with Google Drive. As far as I can tell, there's no way to use the implicit Cloud Function credentials or related environment variables to authorize with Drive, so I've had to resort to either including the credentials.json service account key file in the Cloud Function bundle or by setting an environment variable using that same key file during deployment of the Cloud Function. It'd seem to me that you would be able to use the Cloud Function's

How to specify sound and click_action in firebase cloud function

你离开我真会死。 提交于 2020-03-22 09:06:09
问题 I tried with the following function (node.js v8): exports.sendComNotification = functions.firestore .document('Comunicados/{comID}') .onUpdate((snap, context) => { console.log('Com triggered'); const newValue = snap.after.data(); const msg = newValue.title; var message = { notification: { title: 'Comunicado da Diretoria!', body: msg, badge: '1', sound: 'default', click_action: 'FLUTTER_NOTIFICATION_CLICK', }, topic: "Comunicados" }; return admin.messaging().send(message) .then((response) => {

Firebase tools: login as service account

爷,独闯天下 提交于 2020-03-21 19:06:05
问题 I cannot find way how to deploy firebase project (functions) on behalf of service account. Nothing is said both on documentation page and also I found nothing related in their bug tracker. As described, I run firebase login:ci command but then I need to login myself - and I want login as service account. Such feature is available using gcloud tool, but, as stated in docs, Cloud Functions written using the Firebase SDK for Cloud Functions can't be deployed using the gcloud command-line tool,

Firebase tools: login as service account

我只是一个虾纸丫 提交于 2020-03-21 19:05:34
问题 I cannot find way how to deploy firebase project (functions) on behalf of service account. Nothing is said both on documentation page and also I found nothing related in their bug tracker. As described, I run firebase login:ci command but then I need to login myself - and I want login as service account. Such feature is available using gcloud tool, but, as stated in docs, Cloud Functions written using the Firebase SDK for Cloud Functions can't be deployed using the gcloud command-line tool,

Firebase: Enable the Google Cloud Build API for your Cloud Functions project?

╄→尐↘猪︶ㄣ 提交于 2020-03-21 07:01:08
问题 Hi I am using firebase and the firebase functions. 1 day ago I received an email from Google Cloud with the following content: Starting April 20, 2020, Cloud Functions will use Google Cloud Build, Container Registry, and Google Cloud Storage to build and store your source code, and deploy container image(s) before running them on Google Cloud. You must enable the Cloud Build API for your project(s) to ensure your Cloud Function is built and deployed correctly. Once you enable the API, you may