Skip to content

Lambda calling a external HTTP endpoint #8509

Answered by felixscherz
RajasGujarathi asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, I think this happens because moto runs your lambda function inside a docker container which means the responses.activate is not applied because your lambda code runs in a different environment. You could try to provide a separate http server for the lambda to call and mock responses that way.

moto/moto/awslambda/models.py

Lines 1048 to 1058 in 8007aef

container = self.docker_client.containers.run(
image_ref,
[self.handler, json.dumps(event)],
remove=False,
mem_limit=f"{self.memory_size}m",
volumes=volumes,
environment=env_vars,
detach=True,
log_config=log_config,
**run_kwargs,
)

Let me know if that helped or not:)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@RajasGujarathi
Comment options

Answer selected by RajasGujarathi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants