serverless-dynamodb-local
serverless-dynamodb-local copied to clipboard
Rename --port parameter as it conflicting with serverless-offline --port parameter
Actual 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 [email protected]: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.
@iaforek Take a look at the above PR ^^
I'd say it is confusing to use config file and parameter and then config takes precedence. Especially, if you pass parameter then you are basically explicitly saying use this port and it won't work because of config file. You simply can't easily (with parameters) change two ports at the same time.
Any progress on this? Having different --port seems to be the only way from serverless-offline to being able to test multiple services. Would it be possible to rename the "port" param in dynanamodb-local to dbport?
Any progress on this? Having different --port seems to be the only way from serverless-offline to being able to test multiple services. Would it be possible to rename the "port" param in dynanamodb-local to dbport?
I solved this by simply specifying the ports in the serverless.yml file itself.
custom:
dynamodb:
start:
port: 15002
serverless-offline:
port: 15001
you have 2 options
run sls offline --httpPort 9090
or at the end of serverless.yml file add this
custom:
serverless-offline:
httpPort: 9090
you can choose any port in place of 9090