question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:8
  • Comments:5

github_iconTop GitHub Comments

22reactions
veeneducommented, May 18, 2020

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

15reactions
afifsohailicommented, Dec 26, 2018

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Offline - Serverless Framework: Plugins
Serverless Offline. This Serverless plugin emulates AWS λ and API Gateway on your local machine to speed up your development cycles.
Read more >
Serverless Offline: handle multiple API gateways
If you want to run two or more Serverless API Gateways at the same time locally you can easily do it with --port...
Read more >
Serverless SQL pool self-help - Azure Synapse Analytics
This article contains information that can help you troubleshoot problems with serverless SQL pool.
Read more >
Removals by version - GitLab Documentation
To prevent this error, choose different ports for the metrics and health check ... In GitLab 15.0, support for the tags and tags_count...
Read more >
gcloud run deploy | Google Cloud CLI Documentation
Overview · apply-parameters · apply-software-update · create · delete · describe · list · reschedule-maintenance · update. operations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found