PlatformException(error, Promise was rejected with a value of 'undefined'.,null, null)

So far, I have been battling to get V5 to work right.
I really want to enjoy V5 but I continue to have issues.

I finally got V5 working right, migrated the data from V4, used snappdf for PDF generation and everything seemed to be working right.

Then suddenly, PDF’s won’t generate. I get PlatformException(error, Promise was rejected with a value of ‘undefined’.,null, null).

If I try to view previous PDF’s, I get Internal Server Error 500 on most of them.

I don’t know what’s wrong. Ownership is correct (sudo chown -R www-data:www-data invoiceninja).

I don’t have any other issues at this point but suddenly PDF’s broke. I had no luck getting phantomJS to work either.

Any ideas? I couldn’t find anything about this error.

Having the same issue with PDF preview.

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!

1 Like
  • Are there any details about the 500 in storage/logs

  • Are you able to view the PDF in the client portal

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

Increasing the PHP memory limit should help

Not sure, 500’s should typically log an error

Should I be looking at a different log somewhere else? Laravel.log doesn’t seem to be giving me anything new.

I’m looking in the error log in my root directory (public html for me).

But, I’ve set my memory to -1 (no limit) in my php.ini and still getting the issue.

@david do you have any thoughts?

Dunno what happened but I even tried a completely clean install and now all I get is this PlatformException stuff happening.

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.

Started getting this error again for PDF generation for snappdf. Had to revert back to Phantom. Don’t know how to resolve it with snappdf.

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!

Best of luck!

1 Like

This has started occurring again on my v5.3.17 regardless of trying to use phantomjs or snappdf now.

I can’t get it working even after trying what you suggested.

I updated snappdf, it all responded as per your commands, I changed it to snappdf in the .env

then tried:

  • php artisan optimise
  • /update?secret=
  • Clear cache
  • Refresh data

Tried other browsers, rebooted my server, everything I can think of. It seems that it works for a while in v5 then this occurs.

I don’t know why this issue randomly occurs after a while.

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.

Maybe this will help:

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.

Glad to hear it’s working, thanks for sharing the solution!

cc @david

Thankyou @hillel I was about to share this. It’s my thread on Github as well :slight_smile:

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.

I made a video here for anyone who might need a walkthrough on what worked for me:
Invoice Ninja V5 - PlatformException(error, Promise was rejected - YouTube"

Thanks also to @dramirezbitbrain for adding other solutions to this thread!

2 Likes

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.