Test PDF v5 docker-compose error

I have setup a fresh install of v5 InvoiceNinja with the docker-compose flow.
In the docker-compose.yml file, I’ve set the following environment variable:
PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address'

I am experiencing an issue when testing PDF functionality during setup:
“Oops, looks like something isn’t correct!”

I continued through the setup anyways, and I am unable to preview the PDF for invoices.
Looking at the logs, I only see HTTP request logs to /index.php with no error.

Is there a way to increase the log verbosity of my docker-compose setup so I can better debug this issue?

Below is a photo of the error:

@ntenpas

In the setup phase I don’t think there is a way to check the PDF Generation from Phantom JS

The inbuilt Test PDF functionality only checks the internal implementation of the PDF generator with Puppeteer so it should be safe to ignore this error and proceed.

Thanks, @david
I ignored the error previously and proceeded but was getting 404 pages when trying to view a PDF for a sent test invoice.
Shall I try to reproduce that error, and report back?

@ntenpas

yes please confirm back if you are still seeing errors, 2 things to check before testing.

  1. Ensure your phantom js keys are correct in the .env file
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET=
  1. Always refresh the cache after updating the .env
php artisan optimize
  1. Make sure your webuser has write access to the storage/ folder recursively.

Thanks @david,
I will be away for a few days, but I will eventually confirm back if I’m seeing these errors after adding the proper environment variable settings.
Thanks for the update!
Is it possible to do php artisan optimize in a docker setup with v5?

Hi @david,
I am getting the following error upon viewing a test PDF:
invoice_pdf_preview

I also notice a separate issue:
When I send a email notice for this invoice, the email does not come through.
In the setup phase I tested generation of email and it passed.

Any idea on how to debug from here?
Do you think this 404 error is showing on PDF preview because I have not set it up properly? I ignored the error on the setup page like you advised.

Hi, @hillel

Do you have any insight or ideas on how I could debug this?

The test PDF only works when trying to create the PDF locally, if you are trying to verify phantom JS is working the test PDF will fail.

Thanks, @david.
Just to clarify, I get the 404 error when I try to view the PDF of an invoice I created.
It’s not expected to 404 though, right?

@ntenpas correct, so a 404 in that instance means one of two things.

  1. Permissions errors which prevent the PDF being written to the directory
  2. Failure of puppeteer/phantomJS to generate the PDF.

There should be errors in the logs if there is a permissions issue.

Thanks, @david,
I’m not seeing permissions errors in the logs, so it must be a puppeteer/phantomJS issue.
I set the two phantomJS environment variables, but are there other things I can check to ensure these work?
I would expect the docker-compose flow to have this working out-of-the-box. Are there any other people experiencing my issue? It is easy to reproduce if you run the docker-compose setup flow.

are you seeing any logs at all? if nothing is being written it would also mean a permissions issue.

the other thing to confirm is you are running php artisan optimize after updating your .env file.

I see index.php 404 in my logs, but that’s all.
Is it possible or necessary to run php artisan optimize with the docker-compose setup/flow?
I am just re-running the flow with docker-compose down and docker-compose up -d.
I understand that this should re-start the php application in docker.

What I find frustrating is that PDF generation does not work out-of-the-box with the docker flow (unless I’m setting it up wrong). I’ve followed all the setup steps on the github wiki.
Is it possible to raise this as an issue to the InvoiceNinja developers?

1 Like

I’m getting the same issue (docker & caddy setup with the github wiki, i use debian 10). I set up IN5 through docker and everything is fine so far. I generated a PhantomJS key myself which i use (which is listed in the environment vars, too). The only thing that does not work is creating an invoice-pdf (which throws me a 404) and if i just try to send the mail it throws me an error 500 (internal server error). It would be very nice if you’d help me fix this because i would really love to use IN5 as a daily driver for my business.

edit: after reinstalling invoiceninja, i have the same issue but now, when i try to send the invoice i get an error message like: “please make sure that invoice ninja is installed on the server”. it is actually installed :smiley: since everything else pretty much functions

We rely on the community for docker support, unfortunately we don’t have that expertise internally.

I’d suggest raising an issue on Github https://github.com/invoiceninja/dockerfiles

Thanks, @david,
I’ve raised an issue there.
I will try the setup at some point with a self-generated PhantomJS key to see if that resolves my PDF generation issues.

@niklasbuehler,
I was not getting any logged errors upon sending email with my setup.
My issue was that the invoice email never came through.
I just followed the basic IN5 + Caddy setup listed on the Github wiki.
Maybe a fresh setup will resolve the email 500 error you have.

So, even though you are using a self-generated PhantomJS key, you still get a 404 error upon generation of a PDF for the invoice? Were you able to pass the PDF test during the initial setup phase?
Are you setting the PHANTOMJS_SECRET environment variable also?

I made a fresh install using the default Phantomjs cloud key. PDF Creation works perfectly on the setup page, now and the preview for the Invoice design works too - but i still have no luck getting to work invoicing a client :confused: Are there any clues how to get around that issue? Is PDF creation and Invoice design a different process for generating PDFs than invoicing clients? I really think this is my fault, so i would be very pleased if somebody got a clue :expressionless:

Maybe it needs to be selected, there’s a design option on the edit invoice page on the ‘Settings’ tab.

You can also set your custom design as the default on Settings > Invoice Designs.

@niklasbuehler,
Could you share your docker-compose.yml file that allows PDF creation to work properly?