Closed ghoshpushpendu closed 2 years ago
same here, seems it needs some manual work to extract chromium bin
https://stackoverflow.com/a/62383642/10098625
Follow this link. This ll help. The thing is install headless chrome on your docker. And this link above will guide you to that.
This works for me:
AWS- EC2 Amazon Linux Node JS
Let me save you all complex configs.
Just add these 2 lines in Dockerfile.
RUN apt-get update && \
apt-get install -y fonts-liberation gconf-service libappindicator1 libasound2 libatk1.0-0 libcairo2 libcups2 libfontconfig1 libgbm-dev libgdk-pixbuf2.0-0 libgtk-3-0 libicu-dev libjpeg-dev libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libpng-dev libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 xdg-utils
RUN chmod -R o+rwx node_modules/puppeteer/.local-chromium
And put this line inside the node_modules/html-pdf-node/index.js
const browser = await puppeteer.launch({
headless: true,
args: [
"--disable-gpu",
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--no-sandbox",
]
});
The PDF is getting generated while running the server on local machine.
But when deploying to docker ( ecs Fargate ) it can not create PDF with error Error: Failed to launch the browser process!