[ERROR] Error when deploying "serverless" to "localstack" with "serverless-localstack"

Hello!

I have been learning serverless, so I wanted to deploy a serverless.yml application in localstack using the plugin “serverless-localstack”.

But when I try to deploy I get the following error:

Serverless: Using serverless-localstack
Serverless: Skip plugin function Package.packageService (lambda.mountCode flag is enabled)
Serverless: Skip plugin function AwsCompileFunctions.downloadPackageArtifacts (lambda.mountCode flag is enabled)
Serverless: Skip plugin function AwsDeploy.extendedValidate (lambda.mountCode flag is enabled)
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
........
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Skip plugin function AwsDeploy.uploadFunctionsAndLayers (lambda.mountCode flag is enabled)
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
....
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-east-1%3A000000000000%3Astack%2Fsls-project-one-local%2Fc477882c

 Serverless Error ----------------------------------------

  An error occurred: sls-project-one-local - UPDATE_FAILED.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.22.5
     Framework Version:         2.53.1
     Plugin Version:            5.4.3
     SDK Version:               4.2.6
     Components Version:        3.14.2

My localstack is running on a docker machine with the following docker-compose.yml:

version: '2.1'
services:
  localstack:
    image: localstack/localstack
    ports:
      - "4566:4566"
      - "4571:4571"
      - "8080:8080"
    environment:
      - SERVICES=${SERVICES- }
      - DEBUG=${DEBUG- }
      - DATA_DIR=${DATA_DIR- }
      - PORT_WEB_UI=8080
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR- }
      - KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "${TMPDIR:-/tmp/localstack}:/tmp/localstack"

I have also tried with localstack/localstack-full

My serverless.yml file is as follows:

service: serverless-project

frameworkVersion: '2'

provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          method: get
          path: hello

plugins:
  - serverless-localstack

custom:
  localstack:
    stages:
      - local
    host: http://localhost
    edgePort: 4566
    autostart: true
    lambda:
      mountCode: True
    docker:
      sudo: False
  stages:
    local:
      ...

My version of serverless is 2.54.0

I would appreciate any kind of help, thank you very much in advance!

1 Like

I’m also facing this issue on mac os big sur m1 chip. Someone please help.

Hi AnjaneyuluBatta505 and feredev

We just published version 1.1.1 of the serverless-localstack plugin. It fixes an issue where layers are not deployed when using the mountCode: true configuration for hot reloading. Check out PR#222 for more details.

If you experience any challenges with LocalStack integrations, feel free to reach out to us!

Best,
Joel

Software Engineer @LocalStack