Lambda is currently not working on CircleCI for my current docker configurations

When attempting to run Lambda functions in CircleCI, I encountered below error

Failed to pull Docker image because Docker is not available in the LocalStack container but required to run Lambda functions. Please add the Docker volume mount

My current setup involves running LocalStack as a Docker image in a service and integrating it with my Node.js jobs to execute test cases. While SNS and SQS are functioning correctly since they don’t rely on volume mounts, Lambda is encountering issues.I noticed that in the official documentation, the recommended configuration involves using the orbs executor, which is not currently included in our configuration.

Could someone provide guidance or assistance with integrating LocalStack into our CircleCI setup to address this issue?
Our sample circleci config:

version: 2.1
localstack: &localstack
  image: localstack/localstack:latest
  name: localstack

mongo: &mongo
  - image: circleci/mongo:4.1.13
  - image: memcached:1.6.9
jobs:
  "node-20":
    environment:
      NODE_GYP_VERSION: 8.4.1
    docker:
      - image: cimg/node:20.3
      - <<: *mongo
      - <<: *localstack
    <<: *shared
    parallelism: 15
    resource_class: large
workflows:
  version: 2
  build:
    when:
      and:
        - equal: [ build, << some conditions >> ]
    jobs:
      - "node-20"

error

Hi @aryamohanan,

Can you please try using the LocalStack Orb - localstack/platform to set up your CI pipeline?

@Marcel Thanks for the replay, I attempted to configure the LocalStack Orb - localstack/platform but encountered errors in the process. Would you be able to share functional examples involving Lambda? My intention was to utilize LocalStack for testing our existing application test cases. We need to run LocalStack as a service for our current jobs, similar to the example mentioned above.

Hi Arya — Apologies for the delayed response!

I have prepared a CircleCI config that should explain a good way of setting up LocalStack with Lambda functions: https://github.com/HarshCasper/sample-microservices-apigateway-lambda-dynamodb-sqs/blob/main/.circleci/config.yml

Here is the successful run for the CircleCI job — https://app.circleci.com/jobs/github/HarshCasper/sample-microservices-apigateway-lambda-dynamodb-sqs/4

I hope this helps! Please let me know if you are looking for an alternative job configuration.

1 Like

Thanks Harsh, I appreciate your response. The provided links to your GitHub repository and the successful CircleCI job run are very helpful. I’ll definitely take a look at the config to understand how to set up LocalStack with Lambda functions in my CircleCI configuration.

I’ll let you know if I have any questions or if I’m looking for an alternative job configuration. Thanks again for your assistance!

2 Likes