Rename --port parameter as it conflicting with serverless-offline --port parameter
See original GitHub issueActual Behaviour
If you have serverless offline and dynamodb plugins installed and try to change port of API gateway you use sls offline start --port 3001
to change the port from the default 3000 to 3001. However, that also changes DynamoDB port to 3001 and causes java.net.BindException: Address already in use
Expected Behaviour
Start API Gateway on port 3001 and leave the DynamoDB port on default 8000. Be able to distinguish between sls offline --port XXXX
. Maybe, simply rename parameter to --db-port
Steps to reproduce it
If you have offline
and dynamodb
plugins this starts everything fine: sls offline start
:
Dynamodb Local Started, Visit: http://localhost:8000/shell
...
Serverless: Offline listening on http://localhost:3000
However, pass the --port
parameter and this is what you get:
sls offline start --port 3000
:
Dynamodb Local Started, Visit: http://localhost:3000/shell
...
Serverless: Offline listening on http://localhost:3000
LogCat for the issue
2017-10-13 10:58:00.933:WARN:oejuc.AbstractLifeCycle:FAILED SelectChannelConnector@0.0.0.0:3000: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.Server.doStart(Server.java:293)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer.start(DynamoDBProxyServer.java:83)
at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.main(ServerRunner.java:72)
2017-10-13 10:58:00.933:WARN:oejuc.AbstractLifeCycle:FAILED org.eclipse.jetty.server.Server@69453e37: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.Server.doStart(Server.java:293)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer.start(DynamoDBProxyServer.java:83)
at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.main(ServerRunner.java:72)
Could not start server on port 3000: Address already in use
Would you like to work on the issue?
Please assign to someone.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:5
Top GitHub Comments
you have 2 options
run
sls offline --httpPort 9090
or at the end of
serverless.yml
file add thisyou can choose any port in place of 9090
I solved this by simply specifying the ports in the
serverless.yml
file itself.