google-cloud-functions

How can I get the hosting url instead of functions url in firebase functions for https

别说谁变了你拦得住时间么 提交于 2020-06-25 21:55:29
问题 I have dynamically generated urls that I need to create for staging and production environments. I am doing a mix of Firebase hosting and functions. I am also using Firebase config to route urls to my Firebase functions "app". When I try to get the hosting url when I visit my site with req.get('host') inside a Firebase function I get the functions url. How can I get the Hosting url? - the url that triggered the firebase function? 回答1: If you examine the contents of req.headers , you'll find

Cloud Functions ERROR: cannot convert an array value in an array value [closed]

て烟熏妆下的殇ゞ 提交于 2020-06-25 07:58:12
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Improve this question I am trying to pass in this data into a field of a document using Cloud Functions: [ [ '-LXRXPFgA6sC9Mg0GQMt', 1, 'Sushi premium' ], [ '-LXRSAp3jpB8EUbZU-0c', 1, 'Caramel Glazed Donuts' ] ] The error I got is: Error: 3 INVALID_ARGUMENT: Cannot convert an array value in an array

Cloud Functions ERROR: cannot convert an array value in an array value [closed]

懵懂的女人 提交于 2020-06-25 07:57:15
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Improve this question I am trying to pass in this data into a field of a document using Cloud Functions: [ [ '-LXRXPFgA6sC9Mg0GQMt', 1, 'Sushi premium' ], [ '-LXRSAp3jpB8EUbZU-0c', 1, 'Caramel Glazed Donuts' ] ] The error I got is: Error: 3 INVALID_ARGUMENT: Cannot convert an array value in an array

How do i handle secrets in Google Cloud Functions?

痞子三分冷 提交于 2020-06-24 11:39:26
问题 What is the common practice here? There seems to be no tools provided by gcloud . I'm deploying functions from local machine for now, so I can hardcode secrets, but this seems inappropriate. Also, what about CI/CD? I would need to pass secrets as environment variables in this case. Is this even possible atm? 回答1: Since making my comment, I've found a relatively simple way to do this - provide a config .json file. Here's an example I hacked together based on their Slack function example:

Firebase serve --only functions VS local emulator to run cloud functions locally?

╄→гoц情女王★ 提交于 2020-06-24 11:07:12
问题 Up until now I've been doing the following to use and test my functions locally during development: I leave this running in one terminal: firebase serve --only functions And I add this on my client code when I'm initializing my Firebase app: const config = { apiKey: process.env.FIREBASE_APP_API_KEY, authDomain: process.env.FIREBASE_APP_AUTH_DOMAIN, databaseURL: process.env.FIREBASE_APP_DATABASE_URL, projectId: process.env.FIREBASE_APP_PROJECT_ID, storageBucket: process.env.FIREBASE_APP

How to run a Google Cloud Build trigger via cli / rest api / cloud functions?

依然范特西╮ 提交于 2020-06-24 09:23:10
问题 Is there such an option? My use case would be running a trigger for a production build (deploys to production). Ideally, that trigger doesn't need to listen to any change since it is invoked manually via chatbot. I saw this video CI/CD for Hybrid and Multi-Cloud Customers (Cloud Next '18) announcing there's an API trigger support, I'm not sure if that's what I need. 回答1: I did same thing few days ago. You can submit your builds using gcloud and rest api gcloud: gcloud builds submit --no

Google Cloud Functions include private library

こ雲淡風輕ζ 提交于 2020-06-24 08:47:47
问题 I'm looking to write a custom library in node and I'd like to include that with my Cloud Functions. Since this is shared code, I'd like to be able to use it across all my Cloud Functions. What's the best way to write a library of shared code and have that accessed by multiple Cloud Functions. For example, say I have two Cloud Functions, functionA and functionB. I have a node javascript file called "common.js" that has a javascript function that I'd like to expose to both functionA and

Google Cloud Functions include private library

纵然是瞬间 提交于 2020-06-24 08:47:05
问题 I'm looking to write a custom library in node and I'd like to include that with my Cloud Functions. Since this is shared code, I'd like to be able to use it across all my Cloud Functions. What's the best way to write a library of shared code and have that accessed by multiple Cloud Functions. For example, say I have two Cloud Functions, functionA and functionB. I have a node javascript file called "common.js" that has a javascript function that I'd like to expose to both functionA and

Firebase Functions with Yarn workspaces

依然范特西╮ 提交于 2020-06-24 08:36:05
问题 We're starting to adopt a monorepo setup using yarn workspaces and we'd like to have our firebase functions inside it. The repo structure is something like: repo node_modules <- all dependencies packages core commom functions <- firebase functions So, I have 2 problems with this setup: The dependencies of the functions don't live on the same folder as the entry file from functions The functions depends on other packages such as core and commom that are in the repo so yarn symlinks from node

Can't send mail with Cloud Functions for Firebase

元气小坏坏 提交于 2020-06-23 16:01:49
问题 I'm trying to send an email from a Cloud Function using the sendmail package. It works when I host my "send function" locally. And I can deploy the function without problems to my Firebase project. In the log at Firebase I can see this message: Error: queryMx ESERVFAIL hotmail.com at errnoException (dns.js:28:10) at QueryReqWrap.onresolve [as oncomplete] (dns.js:219:19) I'm neither familiar with sending emails from servers or Cloud Functions for Firebase. My question is why I got this error