Help with phantomjs needed


I prepared all the things to make the invoice run today, but when it came to printing the invoices, I ran into a problem I don’t understand.
I didn’t realized there is a problem with my phantomjs local installation, because the tests have been done by invoice ninja via phantomjs cloud, so I didn’t notice there were problems.
No I generated 100 invoices and the pdfs are broken because of the demo key limitation, which is the reason why I now noticed that there is a problem.
Well, the problem is that the local phantomjs doesn’t seem to do its job. The builtin test page on https://my.invoiceninja.local/test_headless just states “Failed to load PDF document.”
Testing with the test.pjs on the commandline says:

root@ninja:~# phantomjs /var/www/html/invoiceninja/resources/test.pjs
“content”: “”,
“console”: []
}TypeError: Attempting to change the setter of an unconfigurable property.
TypeError: Attempting to change the setter of an unconfigurable property.

I don’t have a clue what phantomjs wants to tell me.

But I need to get the invoices out today, so HELP PLEASE :slight_smile:

Edit: Invoice Ninja v4.5.19, phantomjs v2.1.1, on debian 10

I’m not sure I follow, did it work for the first 100 invoices?

Yes. the phantomjscloud service works. The problem is, that the local phantomjs installation doesn’t, and for obvious reasons I don’t want to rely on an external service for invoice generation.

Perhaps I should add the error message as well…

[2020-07-02 11:31:15] production.ERROR: PhantomJS - Invalid response https://hostname/view/ikumrhjebp8d0fflq1tm56xwrsqk5sya?phantomjs=true&phantomjs_secret=blablubbbleh: {"context":"PHP","user_id":1,"account_id":1,"user_name":"My Name","method":"GET","user_agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36","locale":"de","ip":"2a00:1234::1","count":1,"is_console":"no","is_api":"no","db_server":"mysql","url":"test_headless"} []

Maybe this will help

Been there already, done that, didn’t help.

Sorry, that’s all the info I have

Hmmm, any other info about that?
I can not imagine that there is no way in debugging this - there MUST be a way to find out why phantomjs is working fine when called on commandline but results in an unnamed error when called via invoice ninja…
It’s quite a deal breaker if I have to render all PDFs via phantomjs cloud service. Management will not allow this as a permanent solution and thus throws me back for months of work to integrate invoice ninja in our company…

Here’s the relevant code if you’d like to try to debug it.

We’ve had a lot of issues with PhantomJS and are switching to Headless Chrome in v5.

Never heard of headless chrome, but sounds promising… however, since I can’t wait for v5 with our migration, I need a solution for phantomjs… and it’s possible that I just found one.
I know it sounds extremely strange, but I have no clue what’s different compared to yesterday, but now:

root@host:~# phantomjs /var/www/html/invoiceninja/resources/test.pjs
qt.qpa.screen: QXcbConnection: Could not connect to display

I installed phantomjs as package from, and there:

root@host:~# /opt/phantomjs/bin/phantomjs /var/www/html/invoiceninja/resources/test.pjs
“contentType”: null,
“headers”: [],
“id”: 1,
“redirectURL”: null,
“stage”: “end”,
“status”: null,
“statusText”: null,
“time”: “2020-07-06T16:37:36.330Z”,
“url”: “file:///root/YOUR_LINK_HERE”,
“console”: []

The fascinating thing is, that /test_headless is working as well.

I hope it stays that way, since I have no clue how I got it working now…