cloud-functions-emulator icon indicating copy to clipboard operation
cloud-functions-emulator copied to clipboard

restPort (5001) is already in use

Open jasan-s opened this issue 7 years ago • 5 comments

Description

running firebase serve --only functions leads to the following error, although it does run on port 8010 as a backup. but still gives me the error:

E0920 03:52:05.094000000  3448 server_chttp2.c:53] {"created":"@1505904725.094000000","description":"No address added out of total 2 resolved","file":"..\src\core\ext\transport\chttp2\server\chttp2_server.c","file_line":260,"referenced_errors":[{"created":"@1505904725.094000000","description":"Failed to add port to server","file":"..\src\core\lib\iomgr\tcp_server_uv.c","file_line":385,"referenced_errors":[{"created":"@1505904725.094000000","description":"Failed to listen to port","file":"..\src\core\lib\iomgr\tcp_server_uv.c","file_line":277,"os_error":"address already in use"}]},{"created":"@1505904725.094000000","description":"Failed to add port to server","file":"..\src\core\lib\iomgr\tcp_server_uv.c","file_line":385,"referenced_errors":[{"created":"@1505904725.094000000","description":"Failed to listen to port","file":"..\src\core\lib\iomgr\tcp_server_uv.c","file_line":277,"os_error":"address already in use"}]}]}
error: restPort (5001) is already in use

Steps to reproduce

running firebase serve --only functions

Thanks!

jasan-s avatar Sep 20 '17 10:09 jasan-s

Do you have something else running on port 5001?

You should be able to change the restPort used by the emulator in ~/.config/configstore/@google-cloud/functions-emulator/config.json, but I'm not sure if the Firebase tools force it to use 5001.

jmdobry avatar Oct 13 '17 21:10 jmdobry

Also getting this, but don't believe that port is already in use.

ghost avatar Oct 27 '17 00:10 ghost

I have the same error. When checking the content of ~/.config/configstore/@google-cloud/functions-emulator/config.json:

{ "bindHost": "localhost", "grpcPort": 8009, "idlePruneInterval": 60000, "logFile": "logs/cloud-functions-emulator.log", "maxIdle": 300000, "region": "us-central1", "restPort": 8008, "service": "rest", "storage": "configstore", "supervisorPort": 8010, "tail": false, "timeout": 20000, "useMocks": false, "verbose": false, "watch": true, "watchIgnore": [ "node_modules" ], "projectId": "stratfa" }

Non of this ports are being found when running:

$ netstat -vanp tcp | grep 8008
$ netstat -vanp tcp | grep 8010
$ netstat -vanp tcp | grep 8009

luis-pereira-data avatar Nov 06 '17 22:11 luis-pereira-data

Maybe it's trying to start the Emulator when the emulator is already running? Can you check to see if there are rogue Node.js emulator processes?

cc @laurenzlong

jmdobry avatar Nov 13 '17 21:11 jmdobry

When using the firebase CLI, the config file is overridden. The default port where the emulator gets run is 5001, and you can change this to another port by running:

firebase serve --only functions --port=9000

laurenzlong avatar Nov 14 '17 18:11 laurenzlong