phantonjs local basic troubleshooting

On a self-hosted setup (ubuntu 14.04, PhantomJS 2.1.1, invoiceninja 3.9.2) I cant get any invoices attached to emails. The emails go out, but with nothing attached. Ive seen many posts about it, tried several things but Im at a loss to know what is going wrong.

My web server is not accessible to the internet, which I believe it has to be for phantomjscloud (but not I hope for phantomjs locally run).

So I commented out PHANTONJS_CLOUD_KEY, added PHANTOMJS_BIN_PATH=/usr/local/bin/phantomjs and left PHANTOMJS_SECRET (although commenting it out too makes no material difference to what follows).

entering /usr/local/bin/phantomjs -v or phantomjs -v gives me 2.1.1 and tells me Ive installed it correctly.

In invoice ninja I have the attach invoice using local phantomjs checked.

In an existing invoice, I select “email invoice”. The email sends, but no attachment.

The error log gives me this:

production.ERROR: PhantomJS - Invalid response http://192.168.4.80/ninja/public/view/8ygpnyi4lvtfxkwkka41zppbbdk5u7by?phantomjs=true&phantomjs_secret=v4wg0eyxvctrr4ukgszvtip4hijvtog7: {"context":"PHP","user_id":1,"account_id":1,"user_name":"MyUser","method":"POST","url":"http://192.168.4.80/ninja/public/invoices","previous":"http://192.168.4.80/ninja/public/invoices/create","user_agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/61.0.3163.79 Chrome/61.0.3163.79 Safari/537.36","ip":"192.168.4.52","count":19,"is_console":"no","is_api":"no","db_server":"mysql"}

Im unsure what that is telling me. Can anyone help me out?

Try using the link from the error (http://192.168.4.80/ninja/public/view/8ygpnyi4lvtfxkwkka41zppbbdk5u7by?phantomjs=true&phantomjs_secret=v4wg0eyxvctrr4ukgszvtip4hijvtog7) in the test script from the command line.

http://docs.invoiceninja.com/en/latest/configure.html#troubleshooting

Note: you may want to change your phantomjs_secret value after you finish testing.