We’ve been getting these 500 errors on just about every page load since performing the last upgrade (last week I believe?) Not sure what’s causing them, but they’re driving me crazy!
I just checked my error log, and it’s full of the following errors:
[27-Aug-2021 19:15:02 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 8192 bytes) in /xxx/xxx/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/StubPublishCommand.php on line 54
[27-Aug-2021 19:15:02 UTC] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32768 bytes) in /xxx/xxx/public_html/vendor/symfony/error-handler/Error/FatalError.php on line 1
I ended up doing yet another fresh install and changed the PDF generator to snappdf, then performed an artisan optimize. After that, I now have PDF’s working again.
I had this similar issue when I first started using snappdf. I solved it in my installation by making sure that snappdf has the latest chromium version installed. Fortunately @ben made it very easy to do this. On my installation I did this:
cd [invoiceninja base path]/vendor/beganovich/snappdf
./snappdf download --force
If this runs as expected you should see a new directory in the subdirectory [invoiceninja base path]/vendor/beganovich/snappdf/versions with a name like ‘920698-Linux_x64’
On my installation I also made sure I changed owner/group of this directory and all its subdirectories/files to the same owner as the rest of the invoiceninja install (in my case www-data:www-data):
sudo chown -R www-data:www-data 920698-Linux_x64
I cannot guarantee this will solve your particular problem, but it worked on my installation!
It is happening to me too. I installed v5 two days ago and updated from v4. PDFs were working correctly the first day, today I got an issue from my people that they get an error with the PDF.
I’ve solved my issue. The culprit was a change of URL after migrating.
I started with a domain pointed to my v4 installation. I used a temporary domain to install V5, did the migration and then changed the domain from v4 to v5.
Turns out the logo gets migrated and stored in database with full url. When I migrated it got stored with the temporary url and then it tried to load it, but the domain was inactive now. I’ve deleted and reuploaded the logo manually and now everything works fine and dandy.
Thankyou @hillel I was about to share this. It’s my thread on Github as well
I posted my update in the Github issue but here it is as well if anyone runs into this problem. This is what has solved it for me, at least for now.
"I believe I found a solution, at least for now. Not sure if this will permanently solve it yet.
For anyone who might come across this issue, it’s vital to have not only PDF_GENERATOR=snappdf (or hosted_ninja or phantom)
but also vital to have PHANTOMJS_PDF_GENERATION=false (or true if using PhantomJS).
Without this line, Invoice Ninja seems to get tied up trying to use both of them as I would randomly get PhantomJS error pop ups even though PDF_GENERATOR was set to snappdf.
I realise this is in the docs but since the line was not in the .env by default I must have missed it.
It’s important to specify which PDF Generator you don’t want as well as what you do want.
So basically, I had my .env set it to use snappdf bit it didn’t have the line PHANTOMJS_PDF_GENERATION=false as well.
I also had to run php artisan optimize a few times, not just once, to process the changes.
This morning, I updated NODEJS on my server and it broke invoiceninja PDF generator (I was using PhantomJS). I tried to implement SNAPPDF following steps above and youtube video from @kylegp, PDF still not working - same error “Platform Exception”. Nothing in error logs.