localstack / serverless-localstack

⚡ Serverless plugin for running against LocalStack
519 stars 83 forks source link

Error: docker: not found when running in docker compose #235

Closed joshdura closed 11 months ago

joshdura commented 11 months ago

I am trying to run a pretty simple serverless stack (Docker compose, running a Node 16 serverless project) on localstack with this plugin, and any time I try to spin it up I get the following error:

Error:
Error: Command failed: docker ps
/bin/sh: 1: docker: not found
    at ChildProcess.exithandler (node:child_process:402:12)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1100:16)
    at Socket.<anonymous> (node:internal/child_process:458:11)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at Pipe.<anonymous> (node:net:301:12)

Serverless version: 3.24.1 Docker version: 23.0.5 Node version: 16.19.0

serverless-localstack custom config:

localstack:
    debug: true
    stages:
        - local
    host: http://host.docker.internal
    edgePort: 4566
    autostart: true
    lambda:
        mountCode: true

I feel like I am missing some sort of simple setup option somewhere. Anyone have any ideas?

steffyP commented 11 months ago

Hi @joshdura,

could you ellaborate what you mean by "Docker compose"? From your description it seems like you are running the serverless deploy --stage local in a separate docker container, and LocalStack will run in yet another docker container?

If yes, you will need to remove the autostart: true flag from the plugin configuration. This flag will start localstack automatically. With the setup you are describing, you should start LocalStack manually instead.

The error Error: Command failed: docker ps indicates that you are running the serverless deploy somewhere, where the docker cli is not installed.

joshdura commented 11 months ago

@steffyP Sorry, I should have included all my files file to explain my setup. Below is an example of my docker-compose.yml file:

docker-compose.yml ``` version: '3' services: forms-services: container_name: forms-services build: forms-services/ ports: - '3000:3000' expose: - '3000' volumes: - '../forms-service/:/source/' - '../forms-service/node_modules/:/source/node_modules/' command: [ sh, -c, 'cd /source && yarn install --frozen-lockfile && yarn start' ] # Localstack for AWS services localstack: image: localstack/localstack-pro container_name: forms-localstack ports: - "53:53" # only required for Pro - "53:53/udp" # only required for Pro - "443:443" # only required for Pro - "4510-4530:4510-4530" # only required for Pro - "4563-4599:4563-4599" - "8055:8080" environment: - SERVICES=s3,sns,sqs,apigateway,lambda,dynamodb,dynamodbstreams,cloudformation,secretsmanager,elasticache - DEBUG=1 - DATA_DIR=/tmp/localstack/data - LOCALSTACK_API_KEY= - AWS_ACCESS_KEY_ID=local - AWS_SECRET_ACCESS_KEY=local - AWS_DEFAULT_REGION=us-east-1 - DOCKER_HOST=unix:///var/run/docker.sock volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "./secrets:/source/secrets" - "./localstack/init.sh:/etc/localstack/init/ready.d/init-aws.sh" ```

Then below is my serverless.yml file:

serverless.yml ``` service: forms-service frameworkVersion: 3 plugins: - serverless-plugin-typescript - serverless-localstack stages: - local localstack: debug: true stages: - local host: http://host.docker.internal edgePort: 4566 autostart: true lambda: mountCode: true ```

So yes, Docker Compose is running and then spinning up the serverless stack. When started it runs a yarn start command (which runs serverless deploy --stage local). If I run this without autostart: true, I get the following:

Serverless logs ``` 2023-10-14 09:06:36 yarn install v1.22.19 2023-10-14 09:06:36 [1/4] Resolving packages... 2023-10-14 09:06:36 success Already up-to-date. 2023-10-14 09:06:36 $ husky install 2023-10-14 09:06:36 husky - Git hooks installed 2023-10-14 09:06:36 Done in 0.95s. 2023-10-14 09:06:37 yarn run v1.22.19 2023-10-14 09:06:37 $ yarn run deploy:local 2023-10-14 09:06:37 $ serverless deploy --stage local 2023-10-14 09:06:52 (node:70) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023. 2023-10-14 09:06:52 2023-10-14 09:06:52 Please migrate your code to use AWS SDK for JavaScript (v3). 2023-10-14 09:06:52 For more information, check the migration guide at https://a.co/7PzMCcy 2023-10-14 09:06:52 (Use `node --trace-warnings ...` to show where the warning was created) 2023-10-14 09:06:53 2023-10-14 09:06:53 Deploying forms-service to stage local (us-east-1) 2023-10-14 09:06:53 config.options_stage: local 2023-10-14 09:06:53 serverless.service.custom.stage: undefined 2023-10-14 09:06:53 serverless.service.provider.stage: local 2023-10-14 09:06:53 config.stage: local 2023-10-14 09:06:53 config.options_stage: local 2023-10-14 09:06:53 serverless.service.custom.stage: undefined 2023-10-14 09:06:53 serverless.service.provider.stage: local 2023-10-14 09:06:53 config.stage: local 2023-10-14 09:06:53 Using serverless-localstack 2023-10-14 09:06:53 Reconfiguring service acm to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service amplify to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service apigateway to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service apigatewayv2 to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service application-autoscaling to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service appsync to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service athena to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service autoscaling to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service batch to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudformation to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudfront to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudsearch to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudtrail to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudwatch to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cloudwatchlogs to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service codecommit to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cognito-idp to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service cognito-identity to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service docdb to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service dynamodb to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service dynamodbstreams to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service ec2 to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service ecr to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service ecs to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service eks to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service elasticache to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service elasticbeanstalk to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service elb to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service elbv2 to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service emr to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service es to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service events to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service firehose to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service glacier to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service glue to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iam to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iot to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iotanalytics to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iotevents to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iot-data to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service iot-jobs-data to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service kafka to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service kinesis to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service kinesisanalytics to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service kms to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service lambda to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service logs to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service mediastore to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service neptune to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service organizations to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service qldb to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service rds to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service redshift to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service route53 to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service s3 to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service s3control to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service sagemaker to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service sagemaker-runtime to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service secretsmanager to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service ses to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service sns to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service sqs to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service ssm to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service stepfunctions to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service sts to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service timestream to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service transfer to use http://host.docker.internal:4566 2023-10-14 09:06:53 Reconfiguring service xray to use http://host.docker.internal:4566 2023-10-14 09:06:53 serverless-localstack: Reconfigured endpoints 2023-10-14 09:06:53 Skipping reconfiguring of endpoints (already reconfigured) 2023-10-14 09:06:53 Compiling with Typescript... 2023-10-14 09:06:53 Using local tsconfig.json - tsconfig.json 2023-10-14 09:07:10 Typescript compiled. 2023-10-14 09:07:10 endpoints/accounts/handler.ts (207,50): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/folders/handler.ts (64,41): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/folders/handler.ts (65,39): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/folders/handler.ts (81,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/forms/handler.ts (50,41): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/forms/handler.ts (51,39): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/forms/handler.ts (68,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/templates/handler.ts (161,30): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-14 09:07:10 endpoints/templates/handler.ts (162,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. ```

It never seems to get past this, it just gets stuck here. Any thoughts there?

steffyP commented 11 months ago

Hi @joshdura,

when you start form-services and localstack as services with one docker-yaml, then the container running form-services would need to use the http://localstack:4566 to be able to reach the LocalStack instance.
Please refer to the docker documentation as well.

Could you adapt the host in your serverless.yml accordingly and give it another try?

joshdura commented 11 months ago

@steffyP Thanks for the continued help! When running with the following:

localstack:
    debug: true
    stages:
        - local
    host: http://localstack
    edgePort: 4566
    lambda:
        mountCode: true

I still have the same issue. I have tried using localhost as well and no dice. See the log below (note this has now been running for 25+ minutes and no new log messages):

Serverless Logs ``` 2023-10-16 10:38:08 yarn install v1.22.19 2023-10-16 10:38:08 [1/4] Resolving packages... 2023-10-16 10:38:09 success Already up-to-date. 2023-10-16 10:38:09 $ husky install 2023-10-16 10:38:09 husky - Git hooks installed 2023-10-16 10:38:09 Done in 0.78s. 2023-10-16 10:38:09 yarn run v1.22.19 2023-10-16 10:38:09 $ yarn run deploy:local 2023-10-16 10:38:09 $ serverless deploy --stage local 2023-10-16 10:38:25 config.options_stage: local 2023-10-16 10:38:25 serverless.service.custom.stage: undefined 2023-10-16 10:38:25 serverless.service.provider.stage: local 2023-10-16 10:38:25 config.stage: local 2023-10-16 10:38:25 (node:70) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023. 2023-10-16 10:38:25 2023-10-16 10:38:25 Please migrate your code to use AWS SDK for JavaScript (v3). 2023-10-16 10:38:25 For more information, check the migration guide at https://a.co/7PzMCcy 2023-10-16 10:38:25 (Use `node --trace-warnings ...` to show where the warning was created) 2023-10-16 10:38:27 2023-10-16 10:38:27 Deploying forms-service to stage local (us-east-1) 2023-10-16 10:38:27 config.options_stage: local 2023-10-16 10:38:27 serverless.service.custom.stage: undefined 2023-10-16 10:38:27 serverless.service.provider.stage: local 2023-10-16 10:38:27 config.stage: local 2023-10-16 10:38:27 config.options_stage: local 2023-10-16 10:38:27 serverless.service.custom.stage: undefined 2023-10-16 10:38:27 serverless.service.provider.stage: local 2023-10-16 10:38:27 config.stage: local 2023-10-16 10:38:27 Using serverless-localstack 2023-10-16 10:38:27 Reconfiguring service acm to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service amplify to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service apigateway to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service apigatewayv2 to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service application-autoscaling to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service appsync to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service athena to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service autoscaling to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service batch to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudformation to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudfront to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudsearch to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudtrail to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudwatch to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cloudwatchlogs to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service codecommit to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cognito-idp to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service cognito-identity to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service docdb to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service dynamodb to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service dynamodbstreams to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service ec2 to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service ecr to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service ecs to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service eks to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service elasticache to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service elasticbeanstalk to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service elb to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service elbv2 to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service emr to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service es to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service events to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service firehose to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service glacier to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service glue to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iam to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iot to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iotanalytics to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iotevents to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iot-data to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service iot-jobs-data to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service kafka to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service kinesis to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service kinesisanalytics to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service kms to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service lambda to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service logs to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service mediastore to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service neptune to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service organizations to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service qldb to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service rds to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service redshift to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service route53 to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service s3 to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service s3control to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service sagemaker to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service sagemaker-runtime to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service secretsmanager to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service ses to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service sns to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service sqs to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service ssm to use http://localstack:4566 2023-10-16 10:38:44 endpoints/accounts/handler.ts (207,50): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/folders/handler.ts (64,41): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/folders/handler.ts (65,39): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/folders/handler.ts (81,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/forms/handler.ts (50,41): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/forms/handler.ts (51,39): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/forms/handler.ts (68,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/templates/handler.ts (161,30): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:44 endpoints/templates/handler.ts (162,32): Property 'metadata' does not exist on type 'APIGatewayProxyEventV2'. 2023-10-16 10:38:27 Reconfiguring service stepfunctions to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service sts to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service timestream to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service transfer to use http://localstack:4566 2023-10-16 10:38:27 Reconfiguring service xray to use http://localstack:4566 2023-10-16 10:38:27 serverless-localstack: Reconfigured endpoints 2023-10-16 10:38:27 Skipping reconfiguring of endpoints (already reconfigured) 2023-10-16 10:38:27 Compiling with Typescript... 2023-10-16 10:38:27 Using local tsconfig.json - tsconfig.json 2023-10-16 10:38:44 Typescript compiled. ```

Is there any way to get more detailed logs in regards to the host name not being found? I feel like that should be something logged and I am just not seeing it for some reason.

steffyP commented 11 months ago

Hi @joshdura,

from the tests I just run, I would assume this has something to do with very specifics in your project setup, probably related to typescript.

Let's just verify that your setup works in general, by running a sample.

You could use this docker-compose.yml ``` version: '3' services: forms-services: container_name: forms-services build: context: test tty: true depends_on: localstack: condition: service_healthy # Localstack for AWS services localstack: image: localstack/localstack-pro container_name: forms-localstack ports: environment: volumes: ```

Then in a subfolder test add this Dockerfile:

Dockerfile FROM node:18 RUN npm install -g serverless aws-sdk serverless-localstack; RUN echo "service: my-service\n\ frameworkVersion: '3'\n\ \n\ provider:\n\ name: aws\n\ runtime: nodejs14.x\n\ region: us-east-1\n\ \n\ plugins:\n\ - serverless-localstack\n\ \n\ custom:\n\ localstack:\n\ debug: true\n\ stages:\n\ - local\n\ host: http://localstack\n\ edgePort: 4566\n\ autostart: false\n\ lambda:\n\ mountCode: true\n\ \n\ resources:\n\ Resources:\n\ MySQSQueue:\n\ Type: AWS::SQS::Queue\n\ Properties:\n\ QueueName: my-queue"\ >> serverless.yml ENTRYPOINT ["sls", "deploy", "--stage", "local"]

Then just run docker-compose up, which should start LocalStack first, and after it's ready it will run the sls deploy --stage local from the forms-services container. It will only create a queue. You should see logs in the LocalStack container.

I would suggest you try to make this sample work first, and then try to figure out what configuration causes the issue you are seeing.

joshdura commented 11 months ago

@steffyP Thanks for this update. I can confirm it looks like this is definitely an issue with serverless-typescript and serverless-domain-manager. I was able to workaround the domain manager issue by disabling it when deploying locally, but haven't found a 100% solution for the Typescript issues yet. However, it was able to spin up correctly one or two times and looks like I am running into the same issue as #157. I am going to continue to debug this, but I think we can go ahead and close this issue for now until I find a good workaround. Thank you again for your continued support!

steffyP commented 11 months ago

Thanks for the feedback @joshdura. Sorry I didn't pointed you earlier to this: but using the mountCode flag when you run both containers will lead to issues anyhow. It's not indented to work within docker as well.

From our README:

Note that the localstack.lambda.mountCode flag above will mount the local directory into the Docker container that runs the Lambda code in LocalStack. You can either specify the boolean value true (to mount the project root folder), or a relative path to the root Lambda mount path within your project (e.g., ./functions).