shotleybuilder

shotleybuilder

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 · GitHub buildpack. This worked, to my great surprise (as in the deploy didn’t fall over), unlike GitHub - heroku/heroku-buildpack-google-chrome: [DEPRECATED] Classic buildpack that installs Google Chrome. · GitHub, 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 · GitHub
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

Showing Posts 1 to 4

shotleybuilder

shotleybuilder OP

Just checking my emails and have had a reply from the folks at Gigalixir:
“Hey Jason, that’s a tough one. If it relies on global packages, maybe your best bet is to install them on startup with a .profile.d script. I’ve never tried this so I can’t say for sure if it’ll work, but aside from that the only other option is to basically not rely on global packages somehow.”

jesse

jesse

One thing you should try is going back to mix mode if you’re using releases. Most buildpacks were built with Heroku in mind, which is exactly what mix mode basically is. Releases are different because they don’t bundle up the entire /app folder and instead rely on you to specify exactly what you want bundle into the tarball.
See Modifying an Existing App to Run on Gigalixir — GIGALIXIR 1.4.0 documentation
Also, if you really want to stick with releases, you try and figure out which directories and files are required to be bundled and add them in with overlays. See mix release — Mix v1.20.2

shotleybuilder

shotleybuilder OP

Yes, I did that yesterday evening when reading about build packs in the Gigalixir manual.
Last night my bedtime research discovered ChromicPdf. This seems to have been built in response to these challenges. Today’s task is to switch to this package and go for a test drive.
Many thanks for the pointers :+1:

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.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews