Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple serverless process on different ports

Tags:

serverless

I am having multiple serverless applications I am running it locally using serverless offline plugin

I am setting ports like

custom:
  serverless-offline:
    httpPort: 4000

another serverless

custom:
  serverless-offline:
    httpPort: 3000

At any time I am able to run only one service other shows :

Unexpected error while starting serverless-offline lambda server on port 3002: { Error: listen EADDRINUSE: address already in use

But I am not using 3002 anywhere but it shows 3002

what is this error?

127.0.0.1:3002

like image 309
Sugumar Venkatesan Avatar asked Jan 24 '23 18:01

Sugumar Venkatesan


1 Answers

If you go to the serverless docs, you can see that there are three different ports that serverless uses:

$ sls offline --help | grep " port "
--httpPort ......................... HTTP port to listen on. Default: 3000
--lambdaPort ....................... Lambda http port to listen on. Default: 3002
--websocketPort .................... Websocket port to listen on. Default: 3001

You have to specify all 3 of them if you want to run multiple serverless offline lambda servers. The first serverless config should thus look like:

custom:
    serverless-offline:
        httpPort: 4000
        websocketPort: 4001
        lambdaPort: 4002
like image 156
Bob Avatar answered Apr 08 '23 15:04

Bob