Unable to email invoices (IN 4.2.0)

Hi good day,

I have a Self Hosted White labeled installation and I recently updated to version 4.2.0 and now I’m unable to email invoices. The error is “There was an error saving your invoice
Internal Server Error” When in debug mode I see ‘Missing taxtotal taxsubtotal’ pop up in Exceptions when the send email fails. Just for the record I’m on PHP 7.1 and I don’t calculate any taxes on my invoices. Everything in Tax Setting is un-ticked for me.


I think this may be from the new UBL feature, you should be able to fix it by disabling the feature or upgrading to v4.2.1.

Thanks Hillel, that did the trick but now the PDFs are corrupted. I can’t open the emailed PDF on mobile or PC. I will upgrade to 4.2.1 in the mean time.

Are there any related errors in storage/logs/laravel-error.log

I did the update to 4.2.1 but now the PDF isn’t being attached to the email. In the ‘laravel-error.log’ file I have this message: “[2018-03-07 16:44:01] production.ERROR: PhantomJS - Unable to decode”

The error should include a link, what do you see if you manually view the link?

The link takes me to the PDF in the client portal. I was able to download and open it successfully.

Are you requiring a password to access the portal/does the link include a value for PHANTOMJS_SECRET

Yes I have to login to access the Portal.
Here is the entire log entry, I removed what could identify the site or my account name:

[2018-03-07 16:53:43] production.ERROR: PhantomJS - Unable to decode http://WEB-LINK-HERE.com/view/ouml5v1j4ulnueyi6rmiyzkjhhkn3k4n?phantomjs=true&phantomjs_secret= {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“USER-NAME-HERE”,“method”:“PUT”,“url”:“http://WEB-LINK-HERE.com/invoices/68",“previous”:“http://WEB-LINK-HERE.com/invoices/68/edit”,“user_agent”:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0”,“ip”:“IP-ADD-HERE”,“count”:3,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

Try setting a random value from PHANTOMJS_SECRET in the .env file.

This enables the PhantomJS secret to bypass the client password.

I don’t have ‘PHANTOMJS_SECRET’ in my .env file. Should I add it?
The only reference to PHANTOMJS is the PHANTOMJS_CLOUD_KEY setting.


Hi Hillel,
The link now takes me directly to the PDF, no Portal login needed but it’s still not included in the email. The same “PhantomJS - Unable to decode” error is in the log file, only difference is it now uses my random password.

Which version did you upgrade from? Were any other changes made to the server?

If ‘phantomjs=true’ is in the URL you should see the raw data, not the PDF. Other users have reported Nginx fastcgi configurations from preventing the app from seeing some request parameters.

I upgraded from version 4.2.0. I don’t think any other changed were made, it is on HostGator Shared hosting so anything is possible.

I’m not sure… there are very few changes in 4.2.1.

If you want to send the full /view/… URL from the logs to contact@invoiceninja.com I can try to debug the output.

Sure will do.

The email has been sent with the subject ‘Unable to email invoices (IN 4.2.0)’

Thanks, I think the problem may be related to embedding the signature on the PDF.

Please try again with the setting disabled.

Yes, that was it. The PDF was attached and is viewable.