Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing port conflict warnings on MacOS #1369

Closed
r13i opened this issue Apr 13, 2022 · 3 comments
Closed

Missing port conflict warnings on MacOS #1369

r13i opened this issue Apr 13, 2022 · 3 comments
Labels

Comments

@r13i
Copy link

r13i commented Apr 13, 2022

Bug Report

Current Behavior

While trying to run on a custom port with --httpPort 5000, the listener starts normally but it seems the port is already used elsewhere without causing a conflict (see screenshot below).

Sample Code

This shouldn't be relevant in this situation, but here it is in case.

  • file: serverless.yml (generated with sls print)
org: foo
app: foo-v2
service: foo
frameworkVersion: '3'
plugins:
  - serverless-esbuild
  - serverless-offline
provider:
  name: aws
  region: eu-west-1
  stage: dev
  runtime: nodejs14.x
  memorySize: 512
  timeout: 10
  apiGateway:
    description: The foo API
    minimumCompressionSize: 1024
    shouldStartNameWithService: true
    usagePlan:
      throttle:
        rateLimit: 10000
        burstLimit: 1000
  environment:
    STAGE: dev
    AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
    NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000'
  logRetentionInDays: 7
  logs:
    restApi: true
  deploymentBucket: null
  versionFunctions: true
  deploymentBucketObject:
    blockPublicAccess: true
    maxPreviousDeploymentArtifacts: 3
package:
  individually: true
functions:
  hello:
    handler: src/functions/hello/handler.main
    events:
      - http:
          method: get
          path: hello
    name: foo-dev-hello
resources:
  Resources: {}
  Outputs: {}
custom:
  esbuild:
    bundle: true
    minify: false
    sourcemap: true
    exclude:
      - aws-sdk
    target: node14
    define: {}
    platform: node
    concurrency: 10
  • file: handler.ts
import type { APIGatewayHandler } from '@libs/apiGateway';
import { wrap } from '@libs/apiGateway';

const hello: APIGatewayHandler = async () => ({
  statusCode: 200,
  body: 'Hello, world!',
});

export const main = wrap(hello);

Expected behavior/code

It should just return a 200 Hello, world!

Environment

  • serverless version:
sls --version
Framework Core: 3.12.0 (local) 3.12.0 (global)
Plugin: 6.2.1
SDK: 4.3.2
  • serverless-esbuild version: "1.23.3",
  • serverless-offline version: "8.5.0",
  • node.js version: "v16.13.0"
  • OS: macOS 12.2.1

Additional context/Screenshots

Start command:
image

See the response Server header:
image

@dherault
Copy link
Owner

dherault commented Apr 13, 2022

Good catch, thanks!

@dherault dherault added the bug label Apr 13, 2022
@dnalborczyk dnalborczyk removed the bug label Aug 16, 2022
@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Aug 16, 2022

thank you for filing this issue @redouane-dev

I don't believe this can be fixed on our end. node.js itself is throwing an error if the port is already in use, unless we are catching it and ignoring it, but I don't think that's what we are doing, just checked the code.

I also tried to start serverless-offline twice with the same port, and an error is being thrown.

✖ Unexpected error while starting serverless-offline server on port 6000: { Error: listen EADDRINUSE: address already in use ::1:6000

unfortunately I have no idea what would cause such an issue, but I believe it has something to do with your OS and the settings.

@dnalborczyk
Copy link
Collaborator

closing this for house keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants