shotleybuilder

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 :frowning:
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

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.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
Phillipp
Hey, I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement