Serverless-offline: Setting the httpPort option doesn't work

Created on 9 Feb 2020  路  5Comments  路  Source: dherault/serverless-offline

Bug Report

Neither the CLI option --httpPort or the yaml setup below changes the http port - it keeps sticking to 3000.

Sample Code

service: my-service

plugins:
  - serverless-webpack
  - serverless-offline

provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: eu-west-1
functions:
  hello:
    handler: src/handler.default
    events:
      - http:
          method: get
          path: hello
          integration: lambda
custom:
  serverless-offline:
    httpPort: 4000
  webpack:
    webpackConfig: 'config/serverless.webpack.config.js'
    packager: 'yarn'
    includeModules: true

Expected behavior/code
I expect that the port should change to 4000.

Environment

"serverless": "^1.63.0",
"serverless-offline": "^5.12.1",
"serverless-webpack": "^5.3.1",
question

Most helpful comment

hey @mattpocock with v5.x you have to use the port option. unfortunately the master README contains the documentation for the v6 release branch.

https://github.com/dherault/serverless-offline#important

All 5 comments

hey @mattpocock with v5.x you have to use the port option. unfortunately the master README contains the documentation for the v6 release branch.

https://github.com/dherault/serverless-offline#important

same problem here. I think the change has been done to correct the "port" option for dynamodb local plugin.

I tried several things but it doesn't seem to work:

$ sls offline --port 3001
offline: Starting Offline: prod/eu-central-1.
offline: Offline [http for lambda] listening on http://localhost:3002

$ sls offline --httpPort 3001
offline: Starting Offline: prod/eu-central-1.
offline: Offline [http for lambda] listening on http://localhost:3002

I tried both port and httpPort in serverless.yml, both nothing changed:

custom:
  serverless-offline:
      port: 3001      
plugins:
  - serverless-offline

I think upgraded everything (MacOs).

$ sls -v
Framework Core: 1.83.2
Plugin: 3.8.4
SDK: 2.3.2
Components: 2.34.9
````

"devDependencies": {
"serverless-dynamodb-local": "^0.2.39",
"serverless-offline": "^6.8.0"
}
```

ok, this works:

$ sls offline --lambdaPort 3001
offline: Starting Offline: prod/eu-central-1.
offline: Offline [http for lambda] listening on http://localhost:3001
serverless-offline:
    httpPort: 4000
    lambdaPort: 4002
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

conradoramalho picture conradoramalho  路  3Comments

adambiggs picture adambiggs  路  4Comments

MEGApixel23 picture MEGApixel23  路  4Comments

davidroman0O picture davidroman0O  路  4Comments