PlatformException: Promise was rejected with a result of undefined ...?

I’m confused as to why I’m getting this error message when trying to generate PDF previews:

This has just started happening from making a custom template. Now every time I attempt to make a invoice, this shows up in the preview below it.

This is a self-hosted instance running on PHP 7.x and the latest stable Invoice Ninja.

Please advise on what to do next as I have some client invoices to generate and well, PDF functionality is currently broken for my installation.

Is there an error in the browser console? It should display an error 500

Try these steps:

  1. Increasing the PHP memory limit should help
  2. Check your laravel.log file
  3. Try changing your PDF generator to a different provider e.g snappdf in your .env file (maybe you maxed out your Phantomjs limit?) Make sure you run url.com/update?secret= after editing your .env file.
  4. Try re-uploading your logo file. This fixed the problem for me.
  5. If you’re not using Phantomjs add this line to your .env file:
PHANTOMJS_PDF_GENERATION=false

I also found a YouTube video that maybe of assistance to you.

1 Like

Thanks for replying. The only warning I have is “Warning: Indexing all PDF objects” from the console on the Browser side.

The laravel.log file shows something along the lines of:

[2021-12-01 07:57:07] production.ERROR: There was an error generating the PDF with Phantom JS {"exception":"[object] (App\\Exceptions\\PhantomPDFFailure(code: 0): There was an error generating the PDF with Phant(.....)

…with a stack trace containing paths that are private.

I don’t know how to switch to SnapPDF, do I specify something in the env file?

There’s more info about the available options here:

https://invoiceninja.github.io/docs/self-host-troubleshooting/#pdf-conversion-issues

Thanks, that fixed the issue. Switching to Snap PDF solved it.