Invoice PDF contains SalesNinja login screen - but no invoice

I recently upgraded to 5.2.16 (via Softaculous) on an installation that was working well before the upgrade. I now see the following when I try to view a pdf in Invoices:

I have looked in the file system under ./ninja/public/storage/… and the PDF itself does indeed contain the same content:

I am using phantomJS with a free account and api key which was working fine before the upgrade.

.env variables are:

PDF_GENERATOR=phantom
PHANTOMJS_PDF_GENERATION=true
PHANTOMJS_KEY=‘ak-3v94z-4sg0w-x2j91-xxxxx-xxxxx’
PHANTOMJS_SECRET=secret

Would appreciate your help - I’ve spent half a day on this so far and have been unable to invoice clients this month :confused:

Thanks a million!

@david any thoughts?

It’s been a while, but thought I’d update you with my resolution. In the absence of a response from you guys (I know you’re busier than busy things), and in the face of other recurring issues in the setup of my old (shared) hosting provider, I decided to try an experiment.

I exported my Invoice Ninja database; set up a Google Cloud account; did a clean install of Invoice Ninja 5.2.16; imported my database; played around with Snappdf for a while and managed to get it working in place of PhantomJS webservice; regenrated all my historical invoices using Snappdf.

Happy to report that this strange issue never recurred, and that many other things seem to be working better since I got out from under my old service provider. I have happily been upgrading through the UI ever since then, and my cron jobs now work properly as well!

Still no idea how this PDF error occurred in the first place, but that is now of secondary importance :slight_smile:

1 Like

I had this happen with the phantomjs local install during testing, but I’m not sure the cause (or resolution). Note: clean self-hosted installation on Ubuntu. This was the first invoice we generated and test paid.

Is there a way to force a regeneration or any idea how it came about in the first place?

Opening the invoice for edit shows a good rendering, but I can’t see how to resave it.

Thanks!

My installation experiences the same. Using snappdf, it shows a complete login page. When using hosted_ninja, I see two dots: a part of the loader of the login page.
How can you debug the HTML-page the generator sees?

I’m running everthying in a custom Docker. So, it’s a fresh installation each time. This started after adding/removing API tokens and upgrading to v5.6.3. So, I presume it’s related to the tokens or something in the database?

@david can you please advise?

sounds like dns resolving issue from inside your container.

Thanks for your feedback @david.
What hostname would it fail to resolve?

It’s running on Fly.io, so there is an internal and external host. The external host goes true a load balancer. But I get exactly the same regardless of using the local snappdf or the external hosted_ninja. The APP_URL is the one I use to access the site. So I presume hosted_ninja uses the same?

What’s the URL hosted_ninja fetches? How does it authenticate?

I think if it wouldn’t resolve the hostname, you would see a blank page, not the login screen?

Strangely, the preview below the page works, but the download PDF, and view PDF do not - both in the administrative and client portals.

inside the container, can you resolve pdf.invoicing.co

this is the URL to our pdf generators.

Found it! I was using short boolean variants:
PHANTOMJS_PDF_GENERATION = “f”
instead of
PHANTOMJS_PDF_GENERATION = false

Which works for some programs, but apparently not for PHP. The “f” was translated to true, and the scripts still use Phantom if that variable is true, regardless of the PDF_GENERATOR setting (discovered in the source code). It gave the login form because I cleared the Phantom secret. It’s strange Phantom even worked without an API key set.