I have had the same problem. Ended up pulling the necessary libraries+fonts from Amazon Linux 2 image like followed:
1) Run and enter the docker container for Amazon Linux 2:
docker run -it --rm amazonlinux:2.0.20191217.0
2) Install the necessary tools inside of the docker container, and automatically prepare the necessary dependencies (64-bit based):
mkdir -p /deps
yum install -y yum-utils rpmdevtools
yum install -y libXrender.x86_64 fontconfig.x86_64 freetype.x86_64 libXext.x86_64 libX11.x86_64 expat.x86_64 libxcb.x86_64 libXau.x86_64
yumdownloader libXrender.x86_64 fontconfig.x86_64 freetype.x86_64 libXext.x86_64 libX11.x86_64 expat.x86_64 libxcb.x86_64 libXau.x86_64
rpmdev-extract *rpm
cp /tmp/*/usr/lib64/* /deps
cp -R /tmp/*/etc/fonts /deps/
3) Open a new termial windows and navigate into the PDF lambda folder. Using docker ps
command, locate the container id and paste following command:
docker cp <CONTAINER_ID>:/deps/ . && mv deps/* . && rmdir deps
4) Replace the content of <your_lambda_path>/deps/fonts/fonts.conf
with this, or provide your own config + font files:
<fontconfig>
<dir>/var/task/fonts/</dir>
<cachedir>/tmp/fonts-cache/</cachedir>
<config></config>
</fontconfig>
5) Inside your handler you will need to set following to find the font:
process.env['FONTCONFIG_PATH'] = process.env['LAMBDA_TASK_ROOT'] + '/fonts'
After doing so, simply zip your package and deploy as you usually have.
Hope that helps