Closed IrshadMar closed 10 months ago
Have you been able to sort that issue yourself? I'm trying to also set it up on AWS Lambda, but failing miserably. No matter what dependencies I install I always get an exception back that some of the dependencies are missing.
@IrshadMar I think I managed to set it up by adding following lines to my dockerfile
FROM public.ecr.aws/lambda/dotnet:6
RUN yum install -y libXext \
libXrender
RUN curl -SL "https://github.com/rdvojmoc/DinkToPdf/raw/v1.0.8/v0.12.4/64%20bit/libwkhtmltox.so" --output ./libwkhtmltox.so
To use zip deployments you would need to modify your lambda to install libXext and libXrender and add the lib to /var/task or where do you keep your dlls.
It looks like the code after publish is unable to load libwkhtmltox.so located in runtimes folder.
I was unsuccessful in solving this issue even after trying the docker solution mentioned by @stysiok above.
While running the docker build I am getting the below error at yum install
Used the below command. RUN yum install -y libXext \ libXrender
After deployment I am still getting ---> System.NotSupportedException: Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.
This solved it for me https://www.appsloveworld.com/docker/100/58/unable-to-load-shared-library-libgdiplus-or-one-of-its-dependencies-while-runni
Docker file: FROM public.ecr.aws/lambda/dotnet:6 WORKDIR /var/task
RUN yum clean all && yum update -y RUN yum install -y amazon-linux-extras RUN amazon-linux-extras install epel -y RUN yum install -y libgdiplus
COPY publish/* /var/task/
I am running the pdf conversion code in aws lambda function using .net6 and aws linux 2. In the main page documentation, the following instruction is there for creating a docker image.
_Insert the below lines before the WORKDIR /app command
RUN apt update RUN apt install -y libgdiplus RUN ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so RUN apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb RUN gdebi --n wkhtmltox_0.12.5-1.stretchamd64.deb RUN apt install libssl1.1 RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so
Please help me to resolve this issue while deploying it to aws lambda using .zip files. Or what will be the corresponding commands to use when creating a docker image with amazon linux2. Or please instruct me what base image can be used to make it work.