google-cloud-functions

Firebase CLI deploy error: “Deploys to runtimes below Node.js 10 are now disabled in the Firebase CLI.”

爷,独闯天下 提交于 2021-01-03 03:12:50
问题 I have a project using Cloud Functions for Firebase, and after updating the Firebase CLI to version 9.0.0, I am getting an error message: Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": "10"}, {"node":"12"}, and {"node":"14"}. Deploys to runtimes below Node.js 10 are now disabled in the Firebase CLI. Existing Node.js 8 functions will stop executing on 2021-03-15. Update existing functions to Node.js 10 or greater as soon as

FIrebase Firestore onCreate Cloud Function Event Params Undefined

蓝咒 提交于 2021-01-02 06:36:14
问题 I have tried following Firebase's documentation and other SO posts to access a parameter value for a cloud function I've successfully deployed. Unfortunately I've still been receiving a Type Error: cannot read property 'id' of undefined I've logged event.params and it is outputting as undefined, so I understand the issue, but am unsure how, syntactically, I'm supposed to derive the param value. Below is my js code for reference: exports.observeCreate = functions.firestore.document('/pathOne/

How to restrict email domains in Firebase Authentication

邮差的信 提交于 2021-01-01 06:41:26
问题 I have a question regarding firebase authentication. Actully I am making a dashboard for my company, and I will host it in firebase. I want to restrict the email authentication only to my comany domain (ex: cat.com). But I went through the stackoverflow answers and I found I can impose rule in database. But the issue is that I will be calling external databases to fetcj data using Firebase Function and serve it to website(dashboard). So no domain specific rule will apply there. Below is the

How to restrict email domains in Firebase Authentication

落爺英雄遲暮 提交于 2021-01-01 06:40:20
问题 I have a question regarding firebase authentication. Actully I am making a dashboard for my company, and I will host it in firebase. I want to restrict the email authentication only to my comany domain (ex: cat.com). But I went through the stackoverflow answers and I found I can impose rule in database. But the issue is that I will be calling external databases to fetcj data using Firebase Function and serve it to website(dashboard). So no domain specific rule will apply there. Below is the

Firebase + Next.js serverless, on GCP - How to manage staging, production + local

无人久伴 提交于 2021-01-01 06:36:32
问题 I'm using React with next.js and Google Cloud functions to serve the app. I also use firebase. I'm looking for the best way to automatically configure the staging and production configuration for the 3 environments. Production: Uses production credentials Staging: Uses staging credentials Local: Also uses staging credentials I have two Firebase projects and currently switch between the configuration using the firebase.js file in my app. I swap out the config object, then deploy. I want to be

Firebase + Next.js serverless, on GCP - How to manage staging, production + local

六月ゝ 毕业季﹏ 提交于 2021-01-01 06:36:05
问题 I'm using React with next.js and Google Cloud functions to serve the app. I also use firebase. I'm looking for the best way to automatically configure the staging and production configuration for the 3 environments. Production: Uses production credentials Staging: Uses staging credentials Local: Also uses staging credentials I have two Firebase projects and currently switch between the configuration using the firebase.js file in my app. I swap out the config object, then deploy. I want to be

SyntaxError: Cannot use import statement outside a module Firebase Functions

大兔子大兔子 提交于 2020-12-30 07:23:33
问题 I'm, having an issue with my Firebase function. I'm getting the below error. SyntaxError: Cannot use import statement outside a module below is my code: import * as functions from 'firebase-functions'; import * as sgMail from '@sendgrid/mail'; sgMail.setApiKey(key); export const weeklyReminder = functions.pubsub.schedule('every Wednesday 21:00').onRun(async context =>{ const msg = { to: 'email@gmail.com', ... }; return sgMail.send(msg); }); How do you import into firebase functions? 回答1: Are

SyntaxError: Cannot use import statement outside a module Firebase Functions

帅比萌擦擦* 提交于 2020-12-30 07:23:28
问题 I'm, having an issue with my Firebase function. I'm getting the below error. SyntaxError: Cannot use import statement outside a module below is my code: import * as functions from 'firebase-functions'; import * as sgMail from '@sendgrid/mail'; sgMail.setApiKey(key); export const weeklyReminder = functions.pubsub.schedule('every Wednesday 21:00').onRun(async context =>{ const msg = { to: 'email@gmail.com', ... }; return sgMail.send(msg); }); How do you import into firebase functions? 回答1: Are

Is it a good idea to run Socket.io on a Firebase Cloud Function?

荒凉一梦 提交于 2020-12-29 19:05:08
问题 Implementing it works, but I have read that due to how Cloud Functions are designed they are not the best way to use socket.io. Why? 回答1: Actually, socket.io does not work with Cloud Functions. Cloud Functions have the following properties that make them incompatible with long-lived socket connections: The maximum duration of a Cloud Function can only be 9 minutes. The socket will be forced closed after that time. This is counter to the normal expectation of socket.io to keep a socket

How to use firebase emulators pubsub to test timed functions locally?

a 夏天 提交于 2020-12-29 11:45:23
问题 I'm using firebase for a project and am working on creating a schedule function using the following code. I want to log a message every minute this runs. export const timedQuery = functions.pubsub.schedule('1 * * * *').onRun((context) => { console.log("I am running") return null; }) I have the main logic of the code working under an http function and would like to see if this works locally before deploying to production. Going through firebase docs I've downloaded all of the firebase