I am running fastapi on lambda and I got Lambda error which I believe related to moviepy and opencv. The error text is at the bottom.
My main.py (the part where the error is triggered)
...
from moviepy.editor import VideoFileClip
...
My dockerfile
FROM public.ecr.aws/lambda/python:3.8-x86_64
ADD app app
COPY ./requirements.txt ./requirements.txt
RUN yum -y install mesa-libGL libsndfile
RUN pip install -r ./requirements.txt
ENV NUMBA_CACHE_DIR=/tmp
ENV MPLCONFIGDIR=/tmp
CMD ["app.main.handler"]
My requirements.txt
fastapi==0.89.1
librosa==0.9.2
mangum==0.15.1
mediapipe==0.8.9.1
moviepy==1.0.3
numpy==1.23.5
opencv-python-headless==4.6.0.66
pandas==1.2.1
pydub==0.25.1
Pyrebase4==4.5.0
requests==2.28.1
tensorflow==2.10.0
uvicorn[standard]==0.17.6
The error thrown on Lambda
RequestId: ba8f8500-8338-48c5-b908-8b8f546646f8 Error: Runtime exited with error: signal: segmentation fault
Runtime.ExitError
The error thrown is not helpful at all so I'm having a hard time identifying the cause here. It's kinda weird because few months back, everything run perfectly. only recently the code is failing. What might be the solution for this?