Error 500 for PDF Viewer - Possible Solution

Like many here I’ve had lots of 500 errors trying to view PDFs with nothing in the Laravel logs to give me a clue as to the issue. So I did some poking around and I think I’ve found a possible solution (well it worked for me!!)

It turned out, for me at least, that Chromium in SnapPDF is barfing silently due to missing libraries.

The solution is to drop into the Chromium folder and run ldd chrome | grep not, ie

	cd /path_to_Invoice_Ninja/vendor/beganovich/snappdf/versions/858657-Linux_x64/chrome-linux
	ldd chrome | grep not

The folder below /versions is likely to change when a new version of SnapPDF is available so edit the above cd … line to suit (at the time of writing I’m using v5.1.13).

I had 12 missing libraries on my clean Ubuntu 20.04 server installation when I ran this. Once they were installed, IN runs like a champ.

Hope it works for you too!

1 Like

Hey there, thanks for reporting this. We’re aware of this, many shared hosting companies aren’t able to run this, unfortunately.

However, we’ve documented all required dependencies for snappdf to work. https://invoiceninja.github.io/docs/self-host-troubleshooting/#libatk-so-not-loading-for-google

Thanks.

Thanks Ben. I never saw it in the link you mentioned a few days ago - I found it on the Puppeteer site.

Is it worth pinning this so people can find it? I suspect many (most?) users come here first when they have problems (I certainly do ;))

1 Like

Yep, agree. I think it probably deserves some better spot, because it can be annoying. Thanks for pointing that out. Of course, if you have any suggestion, I’m all ears :+1: