Then I learned that it only happens in pnpm sst dev.
[ERROR] [1715680816939] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/var/task/awslambdaric/__main__.py", line 25, in <module>
main(sys.argv)
File "/var/task/awslambdaric/__main__.py", line 21, in main
bootstrap.run(app_root, handler, lambda_runtime_api_addr)
File "/var/task/awslambdaric/bootstrap.py", line 493, in run
event_request = lambda_runtime_client.wait_next_invocation()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/task/awslambdaric/lambda_runtime_client.py", line 94, in wait_next_invocation
response_body, headers = runtime_client.next()
^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Failed to get next
My Dockerfile:
FROM public.ecr.aws/lambda/python@sha256:3df8dcffd27efbaa191051cd2247e07e4a86aac394c6644e717cda3ca407f212 as build
RUN dnf install -y unzip && \
curl -Lo "/tmp/chromedriver-linux64.zip" "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chromedriver-linux64.zip" && \
curl -Lo "/tmp/chrome-linux64.zip" "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.201/linux64/chrome-linux64.zip" && \
unzip /tmp/chromedriver-linux64.zip -d /opt/ && \
unzip /tmp/chrome-linux64.zip -d /opt/
FROM public.ecr.aws/lambda/python@sha256:3df8dcffd27efbaa191051cd2247e07e4a86aac394c6644e717cda3ca407f212
RUN dnf install -y atk cups-libs gtk3 libXcomposite alsa-lib \
libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \
libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \
xorg-x11-xauth dbus-glib dbus-glib-devel nss mesa-libgbm
RUN mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && chmod +x ~/.aws-lambda-rie/aws-lambda-rie
COPY --from=build /opt/chrome-linux64 /opt/chrome
COPY --from=build /opt/chromedriver-linux64 /opt/
# Move the chromedriver executable to a directory in your PATH
RUN mv /opt/chromedriver /usr/local/bin/
RUN mv /opt/chrome /usr/local/bin
# Make sure the chromedriver executable has executable permissions
RUN chmod +x /usr/local/bin/chromedriver
RUN ls /var/
WORKDIR /var/task
# Copy the current directory contents into the container at /var/task
COPY . /var/task
RUN dnf update -y
RUN dnf install python3 -y
RUN dnf install python3-virtualenv -y
# Create a virtual environment in /venv
RUN python3 -m venv /venv
# Set the virtual environment as the active environment
ENV PATH="/venv/bin:$PATH"
RUN dnf install pip -y
RUN pip install -r requirements.txt --target /var/task
RUN pip install awslambdaric --target /var/task
RUN chmod 755 /usr/local/bin/aws-lambda-rie
RUN chmod 755 /var/task/entry_point.py
RUN chmod 755 /var/task/entry_script.sh
RUN chmod 755 /tmp
ENTRYPOINT ["/var/task/entry_script.sh"]
CMD [ "entry_point.handler" ]
Thing to note. This code worked perfectly two weeks ago.
Not only that, I received the same error on this dockerfile too:
FROM ubuntu:latest
RUN apt update -y
RUN apt install python3 -y
RUN apt install python3-pip -y
RUN mkdir /var/task
RUN pip install awslambdaric --target /var/task
WORKDIR /var/task
# Copy the current directory contents into the container at /var/task
COPY . /var/task
RUN chmod +x /var/task/tester.py
RUN chmod +x /var/task/entry_script.sh
ENTRYPOINT [ "/var/task/entry_script.sh" ]
CMD ["tester.handler"]
Where tester.handler is a function that returns the event from AWS Lambda. The thing is in no case does the lambda ever reach a single line of code in the handlers.
Currently using Ubuntu 24.04.
Has been tested on Ubuntu 22.04 and the same behaviour has been observed (On a different machine).
What seems to be the case is that sst dev is unable to AWS resources with awslambdaric.
I have tested this locally with just docker and it works.
I have tested this in prod/aws resources and it works.
It only does not work when using pnpm sst dev.
Before you say it might be how I setup my routes thats not possible either cause I have had the container work via sst dev before, it seems to be a new development.
Original Issue. https://github.com/aws/aws-lambda-python-runtime-interface-client/issues/142#issue-2295029202
Then I learned that it only happens in pnpm sst dev.
My Dockerfile:
Thing to note. This code worked perfectly two weeks ago. Not only that, I received the same error on this dockerfile too:
Where tester.handler is a function that returns the event from AWS Lambda. The thing is in no case does the lambda ever reach a single line of code in the handlers.
Currently using Ubuntu 24.04. Has been tested on Ubuntu 22.04 and the same behaviour has been observed (On a different machine).
What seems to be the case is that sst dev is unable to AWS resources with awslambdaric. I have tested this locally with just docker and it works. I have tested this in prod/aws resources and it works. It only does not work when using pnpm sst dev.
Before you say it might be how I setup my routes thats not possible either cause I have had the container work via sst dev before, it seems to be a new development.