I’m experiencing a major performance issue after upgrading my dependencies. When I updated the html-to-png library to version 5.0.0, it brought in Puppeteer v22 and my image generation time jumped from 3 seconds to 15 seconds. This is running on AWS Fargate with Ubuntu.
My Docker setup looks like this:
FROM node:slim
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
COPY . $HOME_DIR
RUN rm -fr node_modules/*
RUN npm install
CMD npm start
I’m calling it like this:
await htmlToPngConverter({
output: outputFileName,
html: htmlContent,
puppeteerArgs: {
executablePath: '/usr/bin/google-chrome-stable',
headless: 'shell',
args: ['--no-sandbox'],
},
content: { imageData: base64URI }
})
When I downgrade to version 2.1.1 of the html library (which uses Puppeteer v2.1.1), everything runs fast again at 3 seconds. The slowdown started happening with version 3.0.0 which uses Puppeteer v15. Has anyone else noticed this performance drop with newer Puppeteer versions?