[Public] Deploying IronPDF to AWS Lambda with Docker: "libnss3.so" & Chrome Deployment Errors
Deployment failures when running an IronPDF-powered .NET 8 Lambda function packaged with Docker.
When deploying to AWS Lambda below error might be encountered
"IronSoftwareDeploymentException: Multiple issues occurred while trying to deploy Chrome (libnss3.so: cannot open shared object file: No such file or directory)... (Read-only file system: '/var/task/runtimes')"
Root Causes
-
Missing system libraries:
-
IronPDF’s Chrome engine depends on shared libraries such as
libnss3.so
, which are absent in the Lambda runtime environment.
-
-
Read-only file system:
-
Lambda restricts write access to certain directories (e.g.,
/var/task/runtimes
), which causes embedded deployment to fail.
-
-
Missing embedded resource:
-
The error also indicates that IronPDF couldn't find
Chrome.linux-x64.zip
, which is a fallback mechanism for embedded deployment.
-
Solution
1. Disable GPU and Auto Configuration
These lines are essential to prevent IronPDF from triggering GPU initialization and from trying to auto-configure libraries in an environment where it can't:
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Disabled;
IronPdf.Installation.LinuxAndDockerDependenciesAutoConfig = false;
2. Prevent Automatic Downloads
IronPdf.Installation.AutomaticallyDownloadNativeBinaries = false;
3. Manually Install Linux Dependencies in Dockerfile
To satisfy IronPDF’s runtime requirements, add the following to your Dockerfile before building the app:
RUN apt-get update && \
apt-get install -y \
libnss3 \
libxss1 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libxcomposite1 \
libxrandr2 \
libasound2 \
libpangocairo-1.0-0 \
libgtk-3-0 \
libgbm1 \
libxdamage1 \
libnss3-tools \
Without these dependencies, Chrome cannot run even if the binaries are copied.
4. Avoid Writing to Read-Only Paths
IronPDF attempts to extract resources to paths like /var/task/runtimes
, which is read-only in Lambda.
You must configure IronPDF to extract to a writable path, such as /tmp
in the Lambda code:
IronPdf.Installation.CustomDeploymentDirectory = "/tmp/ironpdf";
This ensures IronPDF uses a valid, writable path during execution.
Example Dockerfile
FROM public.ecr.aws/lambda/dotnet:8
WORKDIR /var/task # install necessary packages RUN dnf update -y
RUN dnf install -y gcc-c++ pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 dbus-glib-devel
RUN dnf install -y libXdamage.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64
RUN dnf install -y libXrandr.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi
RUN dnf install -y xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc
RUN dnf install -y mesa-libgbm.x86_64
RUN dnf install -y nss-3.90.0-3.amzn2023.0.4.x86_64
COPY "bin/Release/lambda-publish" .
Final IronPDF Initialization Example
Installation.AutomaticallyDownloadNativeBinaries = false;
Installation.ChromeGpuMode = ChromeGpuModes.Disabled;
Installation.LinuxAndDockerDependenciesAutoConfig = false;
Installation.CustomDeploymentDirectory = "/tmp/ironpdf"; // Writable path in Lambda
Conclusion
When deploying IronPDF on AWS Lambda using Docker, ensure:
-
Linux system dependencies are explicitly installed in your Dockerfile.
-
You avoid any automatic binary downloads or deployment to read-only paths.
-
Embedded deployment is overridden with a writable custom path like
/tmp
.