-
Notifications
You must be signed in to change notification settings - Fork 79
Closed
Description
I am working on testing a custom Lambda Docker image locally. The function works great when its being ran on AWS, but my team and I need local testing and to be able to test the image using CI. Here is the entire error output I am getting.
Traceback (most recent call last):
File "/opt/bitnami/python/lib/python3.8/runpy.py", line 194, in _run_module_as_main
[ERROR] [1620144999666] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
return _run_code(code, main_globals, None,
File "/opt/bitnami/python/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/bitnami/python/lib/python3.8/site-packages/awslambdaric/__main__.py", line 21, in <module>
main(sys.argv)
File "/opt/bitnami/python/lib/python3.8/site-packages/awslambdaric/__main__.py", line 17, in main
bootstrap.run(app_root, handler, lambda_runtime_api_addr)
File "/opt/bitnami/python/lib/python3.8/site-packages/awslambdaric/bootstrap.py", line 416, in run
event_request = lambda_runtime_client.wait_next_invocation()
File "/opt/bitnami/python/lib/python3.8/site-packages/awslambdaric/lambda_runtime_client.py", line 76, in wait_next_invocation
response_body, headers = runtime_client.next()
RuntimeError: Failed to get next
Executing 'main.handler' in function directory '/'
Here is the Dockerfile.
FROM public.ecr.aws/bitnami/python:3.8-prod
RUN apt-get update && apt-get install --no-install-recommends -y build-essential ffmpeg \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install awslambdaric
RUN apt-get purge build-essential -y && apt-get autoremove -y
WORKDIR /
ENTRYPOINT [ "python", "-m", "awslambdaric" ]
CMD ["main.handler"]
Here are the commands I am using to build and run the container.
$ docker build . -t downloader-lambda:latest
$ docker run -p 9000:8080 -e AWS_LAMBDA_RUNTIME_API="python3.8" -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_LAMBDA_FUNCTION_NAME="downloader" downloader-lambda:latest
The post I was using for reference on how to do this can be found here. Most of our other lambdas aren't in containers so SAM can be used for testing, but we have a few that need to be tested locally that are containerized. Any help would be appreciated!
GZaccaroni, jacob-petterle and trackerdividend
Metadata
Metadata
Assignees
Labels
No labels