google-cloud-functions

Cannot deploy functions to firebase [closed]

ε祈祈猫儿з 提交于 2020-01-16 08:59:42
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 days ago . As said in the title, when I was deploying my functions, some of the functions failed with errors that look like the following: Build failed: {"cacheStats": [{"status": "MISS", "hash": "083901f592ca8770578aa2725fb28aea8db1997e505ec0d1825e328934e5ab87", "type": "docker_layer_cache", "level": "global"}, {"status":

Firebase Cloud Functions: Cannot pass the token retrieved from Realtime Database

戏子无情 提交于 2020-01-15 12:27:09
问题 I'm having issues in retrieving a token saved in realtime database using cloud function's admin.database(). There is only one token to read from the child. Firebase Database structure Here's my code in Index.js const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); exports.sendNotification = functions.database .ref('/Logs/{LogsID}') .onWrite( (change, context) => { const notificationSnapshot = change.after.val(); const status =

page.goto freezes on Google Cloud Functions for some websites

我怕爱的太早我们不能终老 提交于 2020-01-15 09:57:13
问题 I am using: Puppeteer version: 1.13.0 Platform / OS version: Google Cloud Node.js version: 8 await.page.goto("https://somewebsite.com") freezes when I deploy it on Google Cloud functions. I receive timeout error. Navigation Timeout Exceeded const browser = await puppeteer.launch({ headless: true, ignoreHTTPSErrors: true, args: [ '--disable-gpu', '--disable-dev-shm-usage', '--disable-setuid-sandbox', '--no-first-run', '--no-sandbox', '--no-zygote', '--single-process', // <- this one doesn't

Firebase Cloud Function not triggering onCreate

耗尽温柔 提交于 2020-01-15 04:27:12
问题 Trying to handle a contact form submission with Cloud Functions to send the email. The 'Hello World' function fired ok, so I think the set up is fine. The form populates the 'messages' collection, but I'm not getting a log entry (or error) for the trigger on the following: const functions = require('firebase-functions'); const admin = require('firebase-admin') admin.initializeApp(functions.config().firebase); const ref = admin.database().ref(); //if user contacts us exports.sendContactEmail =

Firebase HTTPs Callable iOS Swift

最后都变了- 提交于 2020-01-15 03:24:11
问题 I've create a workable Cloud Function using Firebase in which works using my browser. Now, I'm working with my iOS Swift code, and have successfully installed all dependencies. However, I'm new to iOS/Swift and try to figure out where to call the URL from the Cloud Function? Here is the code Firebase provides to call from within an iOS App: functions.httpsCallable("addMessage").call(["text": "test"]) { (result, error) in if let error = error as NSError? { if error.domain ==

Firebase serve --only functions, admin.auth() locally does not work unless I manually set the key.json

时光总嘲笑我的痴心妄想 提交于 2020-01-15 03:15:53
问题 I am trying to run cloud functions locally using firebase serve --only functions . It works if I manually specify the key.json that is downloaded when I create a service account through firebase console here: https://console.firebase.google.com/project/project-id/settings/serviceaccounts/adminsdk. And then doing export GOOGLE_APPLICATION_CREDENTIALS=key.json . Why do I have to do this? Shouldn't firebase or gcloud handle this correctly? I thought credential in functions.config().firebase was

Stripe Create Usage Record Error - Timestamp must be before the subscription's current period end time - Date.now()?

爱⌒轻易说出口 提交于 2020-01-14 14:35:51
问题 I'm trying to create a stripe usage record for a customer on a metered plan. When I'm using timestamp Date.now() in my request. The error I'm receiving is "Cannot create the usage record with this timestamp because timestamps must be before the subscription's current period end time" This seems self-explanatory. But given the subscription's current period end time isn't for another 14 days, how can Date.now() not be before this. await stripe.usageRecords.create( 'si_EwzQ....', { quantity: 2,

Stripe Create Usage Record Error - Timestamp must be before the subscription's current period end time - Date.now()?

家住魔仙堡 提交于 2020-01-14 14:35:46
问题 I'm trying to create a stripe usage record for a customer on a metered plan. When I'm using timestamp Date.now() in my request. The error I'm receiving is "Cannot create the usage record with this timestamp because timestamps must be before the subscription's current period end time" This seems self-explanatory. But given the subscription's current period end time isn't for another 14 days, how can Date.now() not be before this. await stripe.usageRecords.create( 'si_EwzQ....', { quantity: 2,

How to read cert files from Cloud Functions for Firebase Folder

我们两清 提交于 2020-01-14 13:25:30
问题 I am trying to read a file under certs folder as shown below: -functions | --certs | ---idp-public-cert.perm Here is the code I am using to read the file: fs.readFileSync(path.join(__dirname, 'certs/idp-public-cert.pem')) . When I run the function, I get the following errors: Error: ENOENT: no such file or directory, open '/srv/lib/certs/idp-public-cert.pem' I would appreciate any crew on how to do this. Thanks in advance. 回答1: Just read the file using the relative path certs/idp-public-cert

Function returned undefined, expected Promise or value Firebase log error

本小妞迷上赌 提交于 2020-01-14 13:07:24
问题 Im trying to add a push notification on my app using firebase-function and node.js and all its all working fine, like I got notification from the sender. but my only concern is that the log gave me this error Function returned undefined, expected Promise or value and this is my code: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); exports.sendNotification = functions.database.ref('/notifications/{user_id}/{notification_id}')