i'm trying to generate pdf file for this service i'm building with typescript. now everything works locally but i can't deploy it to AWS as it exceeds the lambda limit. now i am trying to dockerize it and it get's deployed but throws the following error.
"Failed to launch the browser process!\n/var/task/node_modules/puppeteer/.local-chromium/linux-1036745/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n"
this is where it fails
const browser = await puppeteer.launch({
headless: false,
args: args,
ignoreDefaultArgs: ['--disable-extensions'],
executablePath: '/usr/bin/chromium-browser',
});
const page = await browser.newPage();
and here is my Dockerfile
FROM public.ecr.aws/lambda/nodejs:14.2022.09.09.11
ARG FUNCTION_DIR="/var/task"
# Create function directory
RUN mkdir -p ${FUNCTION_DIR}
# Copy package.json
COPY package.json ${FUNCTION_DIR}
# Install NPM dependencies for function
RUN npm install
# Copy handler function and tsconfig
COPY . ${FUNCTION_DIR}
# Compile ts files
RUN npm run build
# Set the CMD to your handler
CMD [ "dist/src/generate.pdf" ]