Started firebase project emulators (which uses cloud functions and firestore) with below command
firebase emulators:start
It runs successfully and gives me a path to connect to the functions and shows a local host url for firestore too.
Then, to execute my jest tests, ran the below command
firebase emulators:exec --only firestore jest
As per the documentation, to connect to local firstore, we need to use exec. But its throwing below error.
i emulators: Starting emulators: firestore
⚠ emulators: emulator hub unable to start on port 4400, starting on 4401
✔ hub: emulator hub started at http://localhost:4401
i Shutting down emulators.
i Stoppping emulator hub
⚠ Port 8080 is not open on localhost, could not start firestore emulator.
i To select a different host/port for the emulator, update your "firebase.json":
{
// ...
"emulators": {
"firestore": {
"host": "HOST",
"port": "PORT"
}
}
}
i Shutting down emulators.
Error: Could not start firestore emulator, port taken.
This error is thrown everytime when I run exec command. Can someone point out what could be wrong?
Edit: Logs from firebase emulators:start
firebase emulators:start
i emulators: Starting emulators: functions, firestore, hosting, pubsub
✔ hub: emulator hub started at http://localhost:4400
⚠ Your requested "node" version "8" doesn't match your global version "10"
✔ functions: functions emulator started at http://localhost:5001
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
i firestore: firestore emulator logging to firestore-debug.log
✔ firestore: firestore emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i hosting[website]: Serving hosting files from: public
✔ hosting[website]: Local server: http://localhost:5000
i hosting[admin]: Serving hosting files from: public
✔ hosting[admin]: Local server: http://localhost:5005
i hosting[b2b]: Serving hosting files from: public
✔ hosting[b2b]: Local server: http://localhost:5006
i hosting[b2c]: Serving hosting files from: public
✔ hosting[b2c]: Local server: http://localhost:5007
i hosting[sdk]: Serving hosting files from: public
✔ hosting[sdk]: Local server: http://localhost:5008
✔ hosting: hosting emulator started at http://localhost:5000
i pubsub: pubsub emulator logging to pubsub-debug.log
✔ pubsub: pubsub emulator started at http://localhost:8085
Update
With a fresh start also the mentioned error is shown. But killing the port made it work.
Added below in scipts part of package.json
"kill": "npx kill-port 5000 5001 8080 8085 4000 9229"
and run
npm run kill
Here all above listed ports aren't reqired. Just 8080 might work in your case but I have other ports too being used by the emulator.
lsof command is not availalble on windows powershell.
A better cross-platform solution is: npx kill-port 8080
Type this in your terminal, where 8080 is your port number:
lsof -ti tcp:8080 | xargs kill
Reason: Failed quitting the previous firebase emulator.
There is an issue filed for firepit (the standalone CLI installable with curl): #1868
Installing it as Node package may help: npm install -g firebase-tools
If this should already be the case, you probably should file an issue there.
I closed the terminal, then opened it again, launched command again and it works
Related
My firebase functions express app is not allowing me to call it when emulating.
The emulator seems to be running fine:
The logs in a better format:
i emulators: Starting emulators: functions
⚠ hub: Error when trying to check port 4400 on ::1: Error: listen EADDRNOTAVAIL: address not available ::1:4400
⚠ hub: Port 4400 is available on 127.0.0.1 but not ::1. This may cause issues with some clients.
⚠ hub: If you encounter connectivity issues, consider switching to a different port or explicitly specifying "host": "<ip address>" instead of hostname in firebase.json
⚠ logging: Error when trying to check port 4500 on ::1: Error: listen EADDRNOTAVAIL: address not available ::1:4500
⚠ logging: Port 4500 is available on 127.0.0.1 but not ::1. This may cause issues with some clients.
⚠ logging: If you encounter connectivity issues, consider switching to a different port or explicitly specifying "host": "<ip address>" instead of hostname in firebase.json
⚠ eventarc: Error when trying to check port 9299 on ::1: Error: listen EADDRNOTAVAIL: address not available ::1:9299
⚠ eventarc: Port 9299 is available on 127.0.0.1 but not ::1. This may cause issues with some clients.
⚠ eventarc: If you encounter connectivity issues, consider switching to a different port or explicitly specifying "host": "<ip address>" instead of hostname in firebase.json
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage
✔ functions: Using node#16 from host.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/app/functions" for Cloud Functions...
⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions#latest in your functions directory.
⚠ functions: Please note that there will be breaking changes when you upgrade.
✔ functions: Loaded functions definitions from source: .
The emulator UI:
The code:
import * as functions from "firebase-functions"
import * as admin from "firebase-admin"
import express, { Express } from "express"
const bodyParser = require("body-parser")
const cors = require("cors")
const routes = require("./routes")
if (admin.apps.length === 0) {
admin.initializeApp()
}
const app: Express = express()
app.use(cors({ origin: true }))
app.use("/api/v2", routes)
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
exports.app = functions.region("europe-west1").https.onRequest(app)
Calling http://0.0.0.0:8087/MY-PROJECT-NAME/europe-west1/app/api/v2 and any subsquent route produces the error message:
Function europe-west1-app does not exist, valid functions are: and then no valid functions.
My emulator is in a docker container with port mappings 8087:8080 (hence the above URL).
I have tried a number of combinations for the endpoint to no avail. I am clearly missing something.
What am I doing wrong?
Routes look like:
router.get("/", centre.hello) // This one return a hello string that I've been using to troubleshoot. no luck
router.post("/centre/add", centre.addCentre)
Edited to add additional logs as requested
I'm an idiot.
Although I had exported "app" as above, I had not provided an index.ts which I believe firebase needed.
I realised this when I deployed the functions live and the error message was a lot more helpful.
Emulators now work as expected
I'm trying to run dagster using celery-k8s and using the examples/celery-k8s as a start. upon running the pipeline from playground I get
Initialization of resources [s3, io_manager] failed.
botocore.exceptions.NoCredentialsError: Unable to locate credentials
I have configured aws credentials in env variables as mentioned in the document
deployments:
- name: "user-code-deployment-test"
image:
repository: "somasays/dagster-usercode-example"
tag: "0.5"
pullPolicy: Always
dagsterApiGrpcArgs:
- "-f"
- "/workspace/repo.py"
port: 3030
env:
AWS_ACCESS_KEY_ID: AAAAAAAAAAAAAAAAAAAAAAAAA
AWS_SECRET_ACCESS_KEY: qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
AWS_DEFAULT_REGION: eu-central-1
and I can also see these values are set in the env variables of the pod and can also access the s3 location after pip install awscli and aws s3 ls see the screenshot below the job pod however throws Unable to locate credentials
Please help
The deployment configuration applies to the user code servers. Meanwhile the celery executor runs your pipeline code in separate kubernetes jobs. To provide your secrets there, you will want to configure the env_secrets field of the celery-k8s executor in your pipeline run config.
See https://github.com/dagster-io/dagster/blob/master/python_modules/libraries/dagster-k8s/dagster_k8s/job.py#L321-L327 for details on the config.
We've been using the emulators for a while now. Suddenly, they stopped working on the machines of two developers (but not all developers). They attempt to invoke firebase emulators:start and are then treated to the following error message: Error: An unexpected error has occurred.
We really have no idea why this is happening. We even tried redoing firebase init and emulators init. So far nothing we have tried has helped. Here is the console output for more detail:
➜ firebase git:(dev-vab) ✗ firebase emulators:start
i emulators: Starting emulators: functions, firestore, database, hosting, pubsub
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth
⚠ Your requested "node" version "10" doesn't match your global version "14"
i firestore: Firestore Emulator logging to firestore-debug.log
i database: Database Emulator logging to database-debug.log
i hosting: Serving hosting files from: public
✔ hosting: Local server: http://0.0.0.0:5000
i pubsub: Pub/Sub Emulator logging to pubsub-debug.log
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/isaacmartin/git_repos/firebase/functions" for Cloud Functions...
✔ functions[updateUser]: firestore function initialized.
✔ functions[handleEventInviteeCreation]: http function initialized (http://0.0.0.0:5001/likemindedly-stage/us-central1/handleEventInviteeCreation).
i emulators: Shutting down emulators.
i ui: Stopping Emulator UI
⚠ Emulator UI has exited upon receiving signal: SIGINT
i functions: Stopping Functions Emulator
i hosting: Stopping Hosting Emulator
i database: Stopping Database Emulator
i firestore: Stopping Firestore Emulator
i pubsub: Stopping Pub/Sub Emulator
i hub: Stopping emulator hub
i logging: Stopping Logging Emulator
Error: An unexpected error has occurred.
Having trouble? Try again or contact support with contents of firebase-debug.log
Now, you will note that we did check the debug log and found the following, which may be related:
[debug] [2020-10-22T22:06:39.394Z] 15:06:39.394 [FirebaseWorkerPool-1-2] WARN com.firebase.core.namespace.NamespaceActorSystem - Request for ns: likemindedly-stage has incorrect domain. Current domain: 0.0.0.0, expected domain: firebaseio-staging.com
{"metadata":{"emulator":{"name":"database"},"message":"15:06:39.394 [FirebaseWorkerPool-1-2] WARN com.firebase.core.namespace.NamespaceActorSystem - Request for ns: likemindedly-stage has incorrect domain. Current domain: 0.0.0.0, expected domain: firebaseio-staging.com\n"}}
[debug] [2020-10-22T22:06:39.448Z] <<< HTTP RESPONSE 404 {"content-length":"231","content-type":"application/json; charset=utf-8","access-control-allow-origin":"*","cache-control":"no-cache"}
[debug] [2020-10-22T22:06:39.448Z] <<< HTTP RESPONSE BODY {
"correctUrl" : "https://likemindedly-stage.firebaseio-staging.com",
"error" : "Namespace likemindedly-stage lives in a different region. Please change your database URL to https://likemindedly-stage.firebaseio-staging.com"
}
It seems to be complaining that we are pointing at local emulators in our config, though, it's not clear why this would be a problem?
I also encountered this issue starting just a few hours ago. It allowed me to start the emulators as normal when I removed the hosts from my firebase.json, but I haven't figured out what exactly is causing the error or how to set the hosts properly outside of the json file.
Another way to solve this problem is to add the new firebase auth emulator to your emulator suite.
I have previously been able to successfully deploy my static site. Now it hangs and tells me I need to re-authenticate, even though I appear to be authenticated.
$ firebase -V
3.9.0
$ firebase login
Already logged in as <>
$ firebase deploy
⚠ Your CLI authentication needs to be updated to take advantage of new features.
⚠ Please run firebase login --reauth
Other firebase commands just hang. I tried
$ firebase list --debug
and it hangs on
>>> HTTP REQUEST GET https://admin.firebase.com/v1/projects
Until eventually I get
Error: connect ETIMEDOUT 104.197.85.31:443
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1093:14)
Error: Server Error. connect ETIMEDOUT 104.197.85.31:443
Any ideas?
Turns out it was a networking/firewall issue blocking access on port 443.
I've been migrating to Firebase 3.0, and with the new changes, we have to use firebase serve on the CLI for local development, and I believe this defaults to port 5000. However, after going through the init process, running firebase serve doesn't do anything after "Starting Firebase development server..." even with specifying port 5000. Attempted fixes:
Tried with other ports, like 5001
Reinstalled Node (4.x and 6.x)
Reinstalled NPM
Removed firebase-cli (since firebase-tools is now being used)
Reinstalled firebase-tools with npm
Tweaked firebase init endlessly
Tried on different user accounts on my computer
Restarted computer
Checked that port 5000 was free by $lsof -i tcp:5000
Tested address variants like localhost:5000 and like 127.x and 192.x
Here is the debug log:
[debug] ----------------------------------------------------------------------
[debug] Command: /usr/local/bin/node /usr/local/bin/firebase serve -p 5000 --debug
[debug] CLI Version: 3.0.0
[debug] Platform: darwin
[debug] Node Version: v6.2.0
[debug] Time: Sun May 22 2016 01:29:59 GMT+0200 (CEST)
[debug] ----------------------------------------------------------------------
[debug]
[info] Starting Firebase development server...
[info]
[info] Project Directory: /Users/user/Documents/localdev/spfwork
Any thoughts on how to fix?
Thank you for your help.
Fixed - firebase serve from firebase-tools (npm) was missing a logger for some errors, which I added on a pull request here: https://github.com/firebase/firebase-tools/pull/143
My error was that localhost was not starting for some reason, so I changed the command to firebase serve -p 5000 -o 127.0.0.1, and specifying the listen port allowed the server to start successfully.
For reference, the error was Error: getaddrinfo ENOTFOUND localhost
You could just change your /etc/hosts file and use firebase serve normally.
To do this:
Launch Terminal
Type sudo nano /etc/hosts and press Return
Enter your admin password Paste
Paste
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Save the file by pressing Ctrl + O
Exit with Ctrl + X
This should fix it.
See this for more
If Firebase cannot find the 'Public' folder, this error might show up. In that case, the error can be resolved by putting index.html and other static files and app assets of the website within the public folder, and executing firebase deploy at the Firebase CLI again.