shotleybuilder
Puppeteer-pdf running on Gigalixir - anyone?
Hi
I wonder if anyone has successfully deployed puppeteer-pdf to Gigalixir? I’m unable to understand how to make headless chrome available on the server.
The error I keep getting is :invalid_exec_path. I had a look at the elixir-pdf-generator and it looks like it’s a known trip hazard. But the discussions / solutions there didn’t help me ![]()
I’ve progressed(?) to deploying the GitHub - minted/heroku-buildpack-chrome-headless buildpack. This worked, to my great surprise (as in the deploy didn’t fall over), unlike GitHub - heroku/heroku-buildpack-google-chrome: Run (headless) Google Chrome on Heroku, but I’m still facing the same error.
I feel sure someone has cracked this particular nut. I would really appreciate the recipe because I’ve come to a dead end and will have to use a different library for pdf conversion that doesn’t use chrome.
Thanks in advance,
remote: -----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: /tmp/buildpacks/000_buildpack-multi elixir
remote: -----> Multipack app detected
remote: =====> Downloading Buildpack: GitHub - minted/heroku-buildpack-chrome-headless
remote: =====> Detected Framework: Headless Chrome
remote: -----> Fetching Chrome binaries at https://s3.amazonaws.com/minted-wedding-websites-deployment/chrome-headless
remote: -----> Moving Chrome binaries to /tmp/build/vendor/chrome/bin
remote: -----> exporting PATH
Most Liked
santosmrclo
Hi, @shotleybuilder.
I know this thread is a little bit old, but I was having the same problem as you yesterday, and this is how I fixed it:
In rel/env.ssh.eex (if you don’t have it, run mix release.initon your project), add the following lines.
#!/bin/sh
apt-get update
apt-get install -y --fix-missing libxss1 lsof libasound2 libnss3
curl -sL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs
npm i puppeteer@^1.7.0
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
npm i puppeteer-pdf -g
cp -R /app/node_modules/puppeteer/.local-chromium/ /usr/lib/node_modules/puppeteer-pdf/node_modules/puppeteer/
npm uninstall puppeteer@^1.7.0
The problem happens because the puppeteer_pdfneeds a global installation of puppeteer-pdf package. It attempts to download the Chromium on that installation, but there is an error regarding permission and everything fails.
The solution is to download the Chromium locally and then copy it to the global package folder. The export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD skips the Chromium download when installing puppeteer-pdf.
I hope it helps you.







