Firebase Emulators are not running - firebase

**When I start firebase emulators:start it shows the following error on the terminal
**
`C:\coding related items\2web development items\Codelabz\Codelabz>firebase emulators:start
i emulators: Starting emulators: auth, functions, firestore, database, hosting, pubsub, storage
! ui: Emulator UI unable to start on port 4000, starting on 4001 instead.
! Your requested "node" version "10" doesn't match your global version "14". Using node#14 from host.
! firestore: Cloud Firestore rules file C:\coding related items\2web development items\Codelabz\Codelabz\firestore.rules specified in firebase.json does not exist.
! firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i firestore: Firestore Emulator logging to firestore-debug.log
firestore: Firestore Emulator UI websocket is running on 9150.
i database: Database Emulator logging to database-debug.log
! database: Fatal error occurred:
Database Emulator has exited with code: 3221225786,
stopping all running emulators
i functions: Stopping Functions Emulator
i database: Stopping Database Emulator
! firestore: Fatal error occurred:
Firestore Emulator has exited with code: 3221225786,
! database: Error stopping Database Emulator
i firestore: Stopping Firestore Emulator
! firestore: Error stopping Firestore Emulator
i eventarc: Stopping Eventarc Emulator
i hub: Stopping emulator hub`
enter image description here
This is the firebase.json file. Please help anyone with this.

Related

Error: HTTP Error: 403, The caller does not have permission

I am trying to upload an app to firebase, using the following command:
firebase serve --only functions,hosting --project project name
however, I'm getting the following error:
Error: HTTP Error: 403, The caller does not have permission
On the IAM-Admin page, I have all permissions set to either Owner or Editor. What am I doing wrong and how do I run the firebase app?
I also encountered a 403 error on the browser when serving Firebase Hosting locally.
I tried changing the port number by
firebase serve --port 50080 --only hosting
Then the page was shown. I use firebase-tools v9.23.0 on macOS 12.

Firebase Cloud Function deployment failed

It seems there is an issue with the Firebase server since the Google Services server downed this December 2020. I can no longer deploy my functions properly, 2 out of 20 deployment only succeed and the rest failed. We already put the issue from Github but it seems there is no team active in the repo.
How can we fixed this as the issue was almost a week now ?
So far this is the latest result after deployment.
+ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
+ functions: required API cloudbuild.googleapis.com is enabled
+ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing Desktop\Projects\Firebase Functions\AdRenture Functions directory for uploading...
i functions: packaged Desktop\Projects\Firebase Functions\AdRenture Functions (20.24 KB) for uploading
There was an issue deploying your functions. Verify that your project has a Google App Engine instance setup at https://console.cloud.google.com/appengine and try again. If this issue persists, please contact support.
! functions: Upload Error: Server Error. read ECONNRESET
Error: Server Error. read ECONNRESET
Error but not all function which is somewhat common before but now it always occur.
i functions: updating Node.js 10 function acceptRentRequest(us-central1)...
i functions: updating Node.js 10 function deleteFacebookUser(us-central1)...
+ functions[validateCredential(us-central1)]: Successful update operation.
+ functions[deleteFacebookUser(us-central1)]: Successful update operation.
+ functions[approvePartnership(us-central1)]: Successful update operation.
+ functions[getList(us-central1)]: Successful update operation.
! functions[acceptRentRequest(us-central1)]: Deployment error.
Server Error. read ECONNRESET
! functions[approveRentRequest(us-central1)]: Deployment error.
Server Error. read ECONNRESET
! functions[announcement(us-central1)]: Deployment error.
Server Error. read ECONNRESET
Functions deploy had errors with the following functions:
acceptRentRequest
announcement
approveRentRequest
To try redeploying those functions, run:
firebase deploy --only "functions:acceptRentRequest,functions:announcement,functions:approveRentRequest"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.

Firebase database emulator fails to start with a java.lang.VerifyError

I have attempted the following
$ firebase emulators:start
i emulators: Starting emulators: functions, database, hosting
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: firestore, pubsub
⚠ Your requested "node" version "nodejs10" doesn't match your global version "12"
⚠ database: Did not find a Realtime Database rules file specified in a firebase.json config file. The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i database: Database Emulator logging to database-debug.log
⚠ database: Fatal error occurred:
Database Emulator has exited with code: 1,
stopping all running emulators
i hub: Stopping emulator hub
i functions: Stopping Functions Emulator
i database: Stopping Database Emulator
⚠ database: Error stopping Database Emulator```
Looking at the database-debug.log I see:
Exception in thread "main" java.lang.VerifyError: Uninitialized object exists on backward branch 209
Exception Details:
Location:
scala/collection/immutable/HashMap$HashTrieMap.split()Lscala/collection/immutable/Seq; #249: goto
Reason:
Error exists in the bytecode
Bytecode:
[snipped]
I'm using Mac OSX. Any suggestions?
It seems I was using an incompatible java version on mac OSX. Using the java runtime from java.com solved the issue.

firebase serve: supervisorPort (5001) is already in use

I built this React App, that allows users to add todo item, and mark an item as completed/active. Todo items are stored in cloud firestore.
I want to enable full-text search on the app, and one way is to create a cloud function that writes index to Algolia whenever cloud firestore witnesses a create operation.
Inside my app root directory, I initialize cloud functions and then implement the onTodoAdded function. After done, I run firebase serve under functions directory and get the errors:
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: build
✔ hosting: Local server: http://localhost:5000
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Server.setupListenHandle [as _listen2] (net.js:1335:14)
at listenInCluster (net.js:1383:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1509:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
error: supervisorPort (5001) is already in use
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
For a complete debug log, find here.
However, this command works fine: firebase serve --only functions.
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
Since it says supervisorPort(5001) is already in use, I lsof -i:5001 and finds no process. I also shut down my laptop and restart, gets the same error.
I find the similar issue here, however didn't find the solution.
I still don't know the reason, but adding --port=9000 solves the problem. For example, firebase serve --only functions --port=9000. Credits to restPort (5001) is already in use #142.
I was having this same error after updating to macOS Mojave 10.14.1 (was fine with 10.14). error: supervisorPort (5001) is already in use and it led me down this rabbit hole of additional updates and configuration that eventually got it to work.
1 Update Node Packages
I updated these items to these versions (latest as of this writing)
firebase-functions: 2.1.0
firebase: 5.5.8
I deleted by node_modules folder and reinstalled all the packages.
2 Firestore Emulator Setup Required
Next time I attempted to serve, firebase gave me this error:
Setup required, please run: firebase setup:emulators:firestore
Because of the weird permissions issues I initially had with mac, I actually have to run
node_modules/.bin/firebase setup:emulators:firestore
3 Then.... Fix Java Runtime Issues
On my next serve attempt, I was presented with firestore: No Java runtime present, requesting install. Mac presents a popup leading to a page where you can "download java for mac". This isn't what you actually need. You really need the Java SE Development Kit which enables command line interface.
Then... You may get these errors the next time you try to serve.
error: restPort (5002) is already in use
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
error: supervisorPort (5001) is already in use
But Firebase still ended up continuing to successfully serve somehow, despite these errors. And it still shows my app over http://localhost:5000.
Hope this helps!

Firebase Functions Error while deploying to emulator

I'm trying to start new Firebase Functions project using latest versions of packages.
I've followed this tutorial https://youtu.be/DYfP-UIKxH0:
Firebase login
Firebase init
Created functions project the same way as tutorial says
Uncommented index.ts content
After that I get this error:
Starting #google-cloud/functions-emulator
[2018-04-04T19:05:12.124Z] Parsing function triggers
[2018-04-04T19:05:12.404Z] Error while deploying to emulator: TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at Promise (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:34:42)
at getService.then (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:33:16)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
⚠ functions: Failed to emulate helloWorld
I have latest functions emulator *1.0.0-beta4.
All other libs are in latest versions...
I'm at point where I have no idea how to debug this better and how to resolve this
This error occurs if an existing process listens on port 5000. Double check if there's a process running, e.g. on Mac OS Sierra
sudo lsof -n -iTCP:5000 | grep LISTEN
Stop this process or run firebase on another port, e.g.
firebase -p 7777 serve --only functions
No need to reinstall packages. Error message is not helpful and we spent some time to find the root cause.
It turned out that it was due other app that was listening on port 5001!
Firebase serve stops with some weird message.
Just check as answer below if ports aren't busy

Resources