Invoices are not downloding trough API

Hi All,
I’m trying to download invoice PDF file trough API, but always I get a HTML file with 140kb size.

I can create invoices (curl -X POST 192.168.1.10/api/v1/invoices …)
I can list invoices (curl -X GET 192.168.1.10/api/v1/invoices …)

But when I try to download an invoice (curl -X GET 192.168.1.10/api/v1/download/1) the only thing I get, is a HTML file where is written “Oops something goes wrong”. Without any error anywhere.

I’ve found on your on your Github issues a suggestion, that I get download PDF with GET request and invitation code, eg: 192.168.1.10/download/{invitation_key}

I have tried, but downloaded file is a corrupt PDF file with same 140kb size.
In the same time the URL with invitation to view invoices works fine (192.168.1.10/view/{invitation_key})

Can you please, suggest me any idea ?

thanks

Can you check storage/logs/laravel-error.log for details about the error.

Hi Hillel Coren,

Yes, I have something like this
"[2016-08-12 20:24:36] production.ERROR: exception ‘Symfony\Component\Debug\Exception\FatalErrorException’ with message ‘Call to undefined function Illuminate\View\Compilers\token_get_all()’ in /var/www/ninja/bootstrap/cache/compiled.php:15485 Stack trace: #0 {main} [] []
"

Maybe this will help…

http://stackoverflow.com/questions/36915752/laravel-call-to-undefined-function-illuminate-view-compilers-token-get-all

Sorry my mistake, this is an error from time when I have installed the ninja.
I cleared laravel-error.log, I tried again, no success and no errors.

Any another idea ?

Not sure… if you see ‘something went wrong’ there should be a message in the logs.

Can you also check you web server error logs.

There is no error on my Apache too, and this is normal because I get HTTP 200 response, but the content is wrong.
And why another API are working, and only this download is broken ?

I have tried to download the pdf from 192.168.1.10/view/{invitation_key}, but my knowledge of JS is not so good, so the problem is still active.

Thanks

I think I may see the problem. We use phantomjscloud.com to generate the PDF, for this to work your app needs to be publicly accessible.