firebase-cli

Debugging Firebase functions locally (node.js)

时光怂恿深爱的人放手 提交于 2021-02-19 05:34:20
问题 see below my code is very simple....it listens to a change on a database field in realtime-database. const functions = require("firebase-functions"); var admin = require("firebase-admin"); exports.onActiveUpdate = functions.database .ref("/profiles/users/{userId}/active") .onUpdate((change, context) => { //code here return true; }); Ive tried to debug code locally with the following commands firebase serve --only functions firebase serve firebase emulators:start I always get the same message.

Firebase emulator cloud function throws cors error when hit from frontend

僤鯓⒐⒋嵵緔 提交于 2021-02-11 13:36:27
问题 I have this function that works perfectly in production however when running locally I get cors errors export const listUsers = functions.https.onRequest(async (req, res) => { res.set("Access-Control-Allow-Origin", "*") const data = await getSomeUsers(10) res.json(data) }) emulators starts fine: cors issue: 回答1: Check this: Deadly CORS when http://localhost is the origin Chrome does not support localhost for CORS requests (a bug opened in 2010, marked WontFix in 2014). To get around this you

How to configure AngularFireAuthModule and/or AngularFireAuth to point to auth emulator

我是研究僧i 提交于 2021-02-10 06:49:06
问题 I believe the auth emulator was released near the end of Oct. 2020. auth emulator feature reqeust I'm trying to configure my locally served angular app to use the auth emulator by having angular/fire/auth make calls to localhost:9099. Is that possible yet? Or is the angular/fire team currently working on this? My firebase config parameter in environment is: firebase: { host: 'localhost:5000', ssl: false, apiKey: '<redacted>', authDomain: 'localhost:9099', databaseURL: '', projectId: '

Firebase deploy keeps giving me an Error: Parse Error in remoteconfig.template.json

青春壹個敷衍的年華 提交于 2021-02-08 23:34:46
问题 I am trying to deploy a web app with firebase but every time I run deploy I keep getting this error Error: Parse Error in remoteconfig.template.json: No data, empty input at 1:1 ^ File: "remoteconfig.template.json" 回答1: You have a reference to a remoteconfig.template.json in your firebase.json files, but that template doesn't exist. This will typically look like: "remoteconfig": { "template": "remoteconfig.template.json" } The solution is to find this section in your firebase.json file, and

How can I reset the default project hosting with firebase?

让人想犯罪 __ 提交于 2021-02-07 07:31:36
问题 I have been using firebase to test apps. I set a certain project as the default. Now I would like to deploy a different project but do not understand how to remove the previous project as a default. (I have almost no experience using the terminal). 回答1: You can change the default project that the Firebase CLI uses in a directory by running: firebase use --add Then in the list of projects, select your project. And then finally for the alias name enter default (or whatever you entered before).

Firebase Project Initialization Error: Cloud resource location is not set for this project

天涯浪子 提交于 2021-02-07 05:12:41
问题 I tried to find a quick answer to this question but couldn't find anything. I am trying to set up an Ionic application to use an existing Firebase project and when running firebase init in the windows console I get this message: Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Firestore requires it. Please see this documentation for more details: https://firebase.google.com/docs/projects/locations 回答1: The message is actually

How does Firebase Firestore emulator work?

早过忘川 提交于 2021-01-28 21:51:13
问题 So far I've been using Firebase Hosting and Functions emulators. But now I'm writting a function that will run based on a Firestore trigger, so I'm looking into the Firestore emulator for development. But how does it work? Does it mimics Firestore completely? Will I be able to read my current Firestore data that it's saved on server? And what if I update, create or delete change documents, will I be really changing them in my real data as well? I'll run it with: firebase emulators:start -

Why doesn't firestore onWrite trigger get invoked on firebase cloud functions emulator?

穿精又带淫゛_ 提交于 2021-01-27 20:05:04
问题 I have a firestore with a collection called "chats"; I use the firestore emulator to insert a new document and I am expecting the onWrite trigger to get called while I am running index.js locally on my firebase cloud functions emulator (by running firebase emulators:start ), but it never does. I know that the emulator is connected to the right firestore emulator since I can read the data (see below), I just can't get the trigger to be invoked. // My setup: const functions = require('firebase

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] -----------------------------------

Delete all firebase functions

眉间皱痕 提交于 2021-01-27 02:40:44
问题 I have a firebase project with multiple functions deployed. Is it possible to remove all the functions in a single go through the CLI? I tried the command firebase functions:delete --region us-central1 and the error output was Error: Must supply at least function or group name. As of right now, I deleted all of them specifying each of their names as such: firebase functions:delete function1 function2 ...functionN but this is very cumbersome. The version of firebase-tools installed is v4.0.0