serverless-localstack icon indicating copy to clipboard operation
serverless-localstack copied to clipboard

ServerlessError: Socket hang up

Open ichinna opened this issue 4 years ago • 4 comments

Hi Team, I am having the below error for a while.

Serverless Error ---------------------------------------
 
  ServerlessError: socket hang up
      at promise.catch.err (/Users/chinnababusadam/MyWorkSpace/bodenstein/app/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:431:27)
      at process._tickCallback (internal/process/next_tick.js:68:7)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              10.16.0
     Framework Version:         1.79.0
     Plugin Version:            3.8.4
     SDK Version:               2.3.2
     Components Version:        2.34.9
 


  1 hook failed

  before hook


  Rejected promise returned by test. Reason:

  Error {
    attempts: 5,
    code: 'ECONNRESET',
    message: 'socket hang up',
  }

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] functional-service: `script/functional-service`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] functional-service script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chinnababusadam/.npm/_logs/2021-03-08T23_17_23_448Z-debug.log

My docker service configuration for localstack:

localstack:
    image: localstack/localstack:latest
    privileged: true
    ports:
      - "4566-4599:4566-4599"
      - "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}"
    environment:
      - EDGE_PORT=4566
      - SERVICES=${SERVICES- }
      - DEBUG=1
      - LOCALSTACK_HOSTNAME=localstack
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=${PORT_WEB_UI- }
      - LAMBDA_EXECUTOR=docker
      - LAMBDA_DOCKER_NETWORK=service_bodenstein
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - bodenstein

My serverless:

plugins:
  - serverless-offline
  - serverless-cloudside-plugin
  - serverless-localstack
  
custom:
    stages:
      - test
    lambda:
      mountCode: False

can you suggest why this is happening and any tips to resolve this?

ichinna avatar Mar 08 '21 23:03 ichinna

Running the projectas is from clone and npm install from https://github.com/antreyes/localstack-demo with no changes and the same error occurs.

Metroxe avatar Mar 21 '21 07:03 Metroxe

+ 1 here could any one take a look at this issue ?

bharadwajturlapati avatar Jun 20 '21 06:06 bharadwajturlapati

Thanks for reporting @ichinna, and apologies for the delay. Can you please try commenting out the EDGE_PORT configuration (and potentially LOCALSTACK_HOSTNAME as well) from your docker-compose.yml:

    #  - EDGE_PORT=4566
    #  - LOCALSTACK_HOSTNAME=localstack

Please make sure to do a docker pull localstack/localstack to use the latest version of the Docker image.

Also, please share the detailed LocalStack logs with LS_LOG=trace enabled in the container environment, as well as the detailed Serverless logs with SLS_LOG=debug. Thanks!

@Metroxe @bharadwajturlapati Can you please share your detailed configurations. Please also validate our docker-compose config via the following command (using the localstack command line):

localstack config validate

whummer avatar Jun 20 '21 09:06 whummer

Better late than never!

I found a possible culprit for this. When I run this serverless, I am overriding my AWS credentials with a bash script, but the bash run time is not picking those, and hitting with default credential in my ~/.aws/credentials . So, I need to revisit why it's not picking those. But when I manually edit my default AWS profile, serverless is smooth as expected.

@whummer I think if possible throwing a proper error could save some time, for bad credentials instead socket hang up.

ichinna avatar Sep 13 '21 19:09 ichinna

I got the same issue Socket hang up when I try to deploy the demo project by the quick start guide step by step.quick start logs:

Deploying localstack-demo to stage local (us-east-1)
config.options_stage: local
serverless.service.custom.stage: undefined
serverless.service.provider.stage: local
config.stage: local
config.options_stage: local
serverless.service.custom.stage: undefined
serverless.service.provider.stage: local
config.stage: local
Using custom endpoint for STS: http://localhost:4566
Using custom endpoint for S3: http://localhost:4566
Creating deployment bucket 'localstack-test-bucket'...
Using custom endpoint for S3: http://localhost:4566

-------- Deployment Bucket Error --------
socket hang up
Using custom endpoint for S3: http://localhost:4566
Creating deployment bucket 'localstack-test-bucket'...
Using custom endpoint for S3: http://localhost:4566

-------- Deployment Bucket Error --------
socket hang up
Using custom endpoint for CloudFormation: http://localhost:4566

✖ Stack demo1 failed to deploy (250s)
Environment: darwin, node 14.18.2, framework 3.23.0 (local) 3.26.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
socket hang up

Did you solve this issue? Or any other can help to resolve it? Thanks. @ichinna @whummer

fisher-he avatar Dec 26 '22 04:12 fisher-he

I got same issue as this. anyone looking at the issue ?

I got the same issue Socket hang up when I try to deploy the demo project by the quick start guide step by step.quick start logs:

Deploying localstack-demo to stage local (us-east-1)
config.options_stage: local
serverless.service.custom.stage: undefined
serverless.service.provider.stage: local
config.stage: local
config.options_stage: local
serverless.service.custom.stage: undefined
serverless.service.provider.stage: local
config.stage: local
Using custom endpoint for STS: http://localhost:4566
Using custom endpoint for S3: http://localhost:4566
Creating deployment bucket 'localstack-test-bucket'...
Using custom endpoint for S3: http://localhost:4566

-------- Deployment Bucket Error --------
socket hang up
Using custom endpoint for S3: http://localhost:4566
Creating deployment bucket 'localstack-test-bucket'...
Using custom endpoint for S3: http://localhost:4566

-------- Deployment Bucket Error --------
socket hang up
Using custom endpoint for CloudFormation: http://localhost:4566

✖ Stack demo1 failed to deploy (250s)
Environment: darwin, node 14.18.2, framework 3.23.0 (local) 3.26.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
socket hang up

Did you solve this issue? Or any other can help to resolve it? Thanks. @ichinna @whummer

ishallbethat avatar Jan 05 '23 04:01 ishallbethat

We removed the temp files, docker temp, images, containers, network and all of the stuff. Upgraded the localstack image and we were good. Just hit restart.

bharadwajturlapati avatar Jan 05 '23 16:01 bharadwajturlapati

Hi,

the issue with deploying the localstack-sample should be resolved in the meantime. Closing the ticket due to inactivity. Please reach out if you still encounter any issues.

steffyP avatar Oct 13 '23 15:10 steffyP