Lee Chambers's picture

First of all i would like to apologize for my post yeasterday, reading back on your fixes Jeremy I realized that what i put could come across as a bit abrupt.

This will be a long post but i will try and include everything with detail not only for other users but also for the devs of the appliance in hope it may catch a future update.

I have started a new post as the other one was a bit messy.

Findings out of the box (OOTB)

Emails queue but do not send
"TECH" template does not work
Company logo will upload but will not display
When creating and invoice or quote click on the "View PDF" button at the top of the screen does not work and constantly tries to load with a spinning circle
Client portal does not open and loads http:/example.com
System healthcheck by clicking the bold i (information) in the bottom left corner and going to healthcheck displays issues todo with
* php size too small should be 512mb at least
* Queue not enabled 
*SnapPDF not enabled

Attempts to fix but does not solve the issues

Clicking on "Settings" then Client Portal and adding in your URL under Domain URL solves nothing as the "Login URL" is http://example.com
These 2 MUST have the same domain entered be it an actual domain address or a local IP address, they must be the same.

Clicking on "Settings" then "Email Settings" does not allow the entry of any SMTP details and filling out the fields available solves nothing, also turning on the option for "Attach PDF" it does not attach or send an email for that matter.

Fixes and resolutions for me that worked.

First off Jeremys fix for the PHP size to 512mb worked

sed -i "\|^memory_limit|s|=.*|= 512M|" /etc/php/8.1/apache2/php.ini
systemctl restart apache2

 This solves the issue of PHP size in the "System Health Check"

Invoice Ninja will work Locally on a local IP address without any SSL but the .env file must be edited for this to happen and also SnapPDF must be installed to enable local PDF generation.
OOTB it uses an external service for this, Jeremy did post how to do this but currently i can not find the post to add it in.

To enable and use SnapPDF after it is installed you need to edit the .env file variables PDF_GENERATOR=hosted_ninja must be changed to PDF_GENERATOR=snappdf (do not use "")

If you are using a domain you dont have to use SSL (https) you can use (http) but you must make the appliance accessible from the internet by forwarding ports on your router and also configuring your domains DNS to point to you IP (if just using IP it must be the external address)

.env file changes that must be made for the appliance to operate correctly

The most important variable to change is this 

http://example.com must be changed to however/wherever you will access invoice ninja from for example..
If you are accessing the appliance locally then this must be changed to the Local IP address of the appliance, such as APP_URL=""
or if accessing from the internet after you have forwarded you port 80 to your local machine you will use your external IP Address such as APP_URL="http://81.777.666.555"
I'm sure you get the idea but just to conclude a domain as well APP_URL="http://invoice.mydomain.com"

Notice the above examples or NOT using SSL (https) this is perfectly fine but if you are not using SSL (https) you MUST also change REQUIRE_HTTPS="true" to REQUIRE_HTTPS="false"

If you are using SSL (https) such as "https://invoice.mydomain.com" then the APP_URL="https://invoice.mydomain.com and the REQUIRE_HTTPS="true" will remain as is OOTB

we will address the queue not running as well while we are here. 
As already been tested by Jeremy the Cronjob works its just the queue is not enabled in invoice ninja so still in the .env file change the QUEUE_CONNECTION=sync to 
QUEUE_CONNECTION=database (do not use "" on this one)

Save changes

Now execute the commands provided by Jeremy 

runuser -l www-data -s /bin/bash -c "php /var/www/invoiceninja/artisan optimize"
systemctl restart apache2

Now going back into the application clicking on "Settings" then "Client Portal" the "Login URL" now displays for example "https://invoice.mydomain.com/client/login"
The field above "Domain URL" must read the same without /client/login so in this case would be "https://invoice.mydomain.com" and save changes by clicking the green Save button (top right)

After this PDF generation should work this can be tested by creating an invoice and clicking View PDF, this also fixes the logo not displaying and if you wish to use the client portal that should also now load correctly.

Note if you already have invoices created before the above changes the logos will not appear on them and you will have to recreate them to pull down the logo from the correct location.

Also checking the Server Health Check this should now have removed all the warnings apart from SnapPDF if you have not installed and enabled it in the .env file.


Back to the .env file again and edit the following



Change MAIL_MAILER="log" to MAIL_MAILER="smtp" <<< Most important

The rest of them change to your smtp servers details i will use google as an example


again once this is done save your changes and run the following commands

runuser -l www-data -s /bin/bash -c "php /var/www/invoiceninja/artisan optimize"
systemctl restart apache2


Now in conclusion to all of the above the main issue of having to do all of the above is the initial setup for invoice ninja is pre canned / already completed, as this setup page is only displayed on first install of invoice ninja this is the only option to actually input all of the above settings in the form and also choose if you with to use SSL or not.

see the link to a youtube video i found showing the said setup page that we dont get an option to configure
v5 Self Host Installation - YouTube skip the video to 1:20

If the setup page was displayed all of the above could be avoided and the appliance would work flawless OOTB and also the inclusion of SnapPDF

Anyway its took me an hour to put this up and about 3 hours to solve last nights strange behavior but I was not prepared to give up on this appliance that quick.

I hope this helps other users and the devs to implement a fix for a future update, any questions please ask i will do my best to answer them. 

Lee Chambers's picture

Just come across something im not sure on the answer to,

Invoice Ninja states there is an update available, but when trying to update the update fails with server error ?

Any ideas?


Jeremy Davis's picture

It sounded like you were fairly equal measure disappointed and frustrated yesterday. I get it. I was quite disappointed that it didn't "just work" either. I hope I was too defensive or otherwise nonconstructive. I think I went ok, but you never know... Regardless, thanks for taking another crack at it. Thanks too for taking the time to step through each point.

For what it's worth, I think part of the issue was that it was such a major update. If we created a new Invoice Ninja v5 appliance from scratch it may well still have had some bugs, but we likely wouldn't have missed quite so many details...

Judging from what you've noted, it sounds like we need to add a domain setting inithook. Although, perhaps we should frame it more in the context of domain or IP, https or http, for local/private (non internet) and public server?

Regarding updates, are there any more details? If you're getting a server error, then the only thing that I can guess is that your permissions aren't quite right (although that seems unlikely?).

For what it's worth, when I tried, it seemed to take a while but it did eventually complete. But then things got weird. First it threw a 500, then I restarted Apache and it seemed to be working ok. But it still said that it was the older version?!

I did a bit of poking around and it appears that there is a final step that needs to be run. That is to hit a specific URL, which needs to include the "UPDATE_SECRET" from the .env file (which we should be randomizing on firstboot - another bug...). So the final step (via an SSH session):

UPDATE_SECRET=$(cat /var/www/invoiceninja/.env | sed -nE "s|^UPDATE_SECRET=(.*)$|\1|p")
curl http://localhost/secret=$UPDATE_SECRET

That gave me the output that it was redirecting to 'https://example.com", but when I refreshed it in my browser, it looks like it worked. Now instead of the blue update icon, I have a yellow one. After i clicked it, it disappeared too.

Looking closer I think that it might actually be better to do a git install (rather than the zip install we do now). I think that would make updating much easier and less problematic. You would need to use the CLI, which may not be as handy as the web UI.

My only other thought there is that it might be worth first checking whether it "just works" if the base URL is set correctly (in the .env) right from the start? If you need to check the .env file to get that "update secret" and hit the specific URL, then I reckon doing it all on the CLI is probably easier (we could even write a simple script).

Regardless, it appears that the alternate to running the above curl command is to use artisan:

runuser -l www-data -s /bin/bash -c "php /var/www/invoiceninja/artisan ninja:post-update"

Regarding the email stuff, did you confirm that a global system wide SMTP config wasn't working before configuring Invoice Ninja? Or did you just configure Invoice Ninja and not worry about getting the system messages (such as security updates installed and other system messages)?

Re the QUEUE change, that's cool. TBH, I started reading the (Laravel) docs that Invoice Ninja suggested for setting that up, but I got a bit bogged down and figured I'd circle back to that later (IIRC that was setting up QUEUE_CONNECTION=supervisor or similar). I'm guessing that "database" uses the DB for caching the queue. My guess is that it's probably not as performant as the superviser way, but clearly a lot easier! If nothing else is needed, I wonder why they don't ship it like that?

Ok read some more docs and answering my own question. It appears that MAIL_MAILER="log" requires QUEUE_CONNECTION=sync. But MAIL_MAILER="log" isn't actually what we want... We want MAIL_MAILER="sendmail"...

As for your note about not having access to the initial setup page. Yeah it's really unfortunate that they don't provide UI access to those settings and the only option is at initial install time (or manually configuring). Unfortunately shipping a not yet installed application isn't really an option. So we'll definitely need to document that process.

FWIW, your notes will definitely be helpful in making the next release much better! Thanks for your patience and tenacity. Hopefully things get a bit smoother from here on in...

Lee Chambers's picture

Hi, i just get "server error" nothing more ... nothing less no numbers or anything, currently i havent got a clue with this one 

Add new comment