99x / 99x/serverless-dynamodb-local

Rename --port parameter as it conflicting with serverless-offline --port parameter

Open
#135 5 comments 8 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
621
Forks
232
PR merge metrics
No merged PRs in 30d

Description

**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 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.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the conflict with `sls offline start` and `sls offline start --port 3000` using the offline and dynamodb plugins. Trace how the shared `--port` value reaches DynamoDB Local and serverless-offline, then verify that changing the API Gateway port leaves DynamoDB on 8000 and avoids the BindException.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.