Invoice email cannot be opened (pdf + button)

Hi forum,

I don’t know what’s changed (self-hosted install), but invoices cannot be opened in the email:

  1. The $viewButton is not working
  2. The pdf is corrupt

Good to know:

  • Laravel 5.3 & php ^7.1

The viewButton problem

  • The actual problem is that the domain url (env('APP_URL')) is not generated in the email.
  • It is however in the settings/advanced/client portal view, where the iFrame input is empty and thus the example is showing http://<my-domain-name>/view/...
  • It works locally, but not on production
  • I logged out $url in /app/Models/Invitation@getLink() and got my domain name.

The pdf problem

  • Pdf generation with the current invoice template has worked before
  • I've tried using local phantomjs & phantomjscloud (with multiple api keys), both unsuccessful atm
  • Not getting any relevant errors - only getting a Balances do not match error, but that seems to be on opening the /invoices/{id}/edit page

Please suggest how to further debug or fix. I very much appreciate your support!


Which version of the app are you using?

Your best bet is finding out what changed, maybe your webhost made a change?

I’m sorry, version 4.1.5 and I’m kinda my own webhost.

I suggest trying to upgrade, that’s a much older version.

You may want to setup a new app and then copy over the database and .env file.

That would be ideal, however we’ve made quite a few changes to the code base and upgrading would be a huge effort, for which I haven’t got the time in the first days.

Any other suggestions maybe?


Sorry, hard to say.

Maybe try checking for differences between local and production?

Ok, I got some things to work again. I’ve:

  • Pushed my local repo to production again
  • Restarted Supervisor workers, status was FATAL

Now, the PDF is not attaching anymore but I’m finally getting a Phantomjs error:

Invalid response

When I run the test script, there’s a couple of errors:

  • ReferenceError: Can't find variable: $ - 116
  • ReferenceError: Can't find variable: fx - 171
  • ReferenceError: Can't find variable: jQuery - 82582
  • ReferenceError: Can't find variable: $ - 349
  • ... and a couple similar errors

Any suggestions on how to debug this?

I appreciate the reactivity here!

It looks like jQuery may be missing from the compiled JavaScrip files.