Download, View, make Private uploaded document not working

First time using InvoiceNinja documents feature. Need to upload PDFs to expenses to keep proof.

When the document is uploaded, the view and download buttons do nothing when pressed (both in the web app, and windows app).

Also when you press the “Private” toggle then save the expense it’s just reverting back to unchecked (not private). Nothing in storage/laravel.log

Already ran php artisan optimize, no difference.

The app is generating invoice PDFs correctly for invoices etc. but the documents is just not working. Also when I go into Documents on the left, and click the document that I uploaded to the expense, it loads infinitely on the right (never shows), and the view/download buttons do nothing.

The app is version v5.7.52-C141


Maybe you need to run php artisan migrate to update the database?

Are there any errors in the browser console?

Console shows the document is not found

It’s not a new installation as I have been using it for invoicing for over a year so can’t run php artisan migrate and lose data. Health check shows no errors, and the in app updater was always used successfully for any updates. I also went to [url]/update?secret=[my update secret] after any updates as well.

Console shows no issues when uploading or deleting a document

But viewing or downloading documents logs a 404, the documents functionality is not working

Do you see a difference if you change to the React app?

No difference. Also 404.

I think these are two separate issues.

Does the documents table contain an is_private field? If the field is missing it could be explained by the migrations not running. You can call migrate on a production database but you may want to back it up first.

I’m not sure why you’re seeing a 404, can you confirm APP_URL is correct in the .env file. @david do you have any suggestions?

The documents table has is_public column and the value for all rows in that column is 1. There’s no is_private column.
I confirm the APP_URL is set correctly in .env

Also is there a way to make documents uploaded to expenses ‘private’ by default? What does public document in an expense even mean - when I enter the client portal of the client linked to the expense there is no category for expenses under documents.

If you edit the expense there’s an “Add documents to invoice” option. If that’s enabled public documents would be visible with the invoice.

@david in addition to the 404, any thoughts on making expense documents private by default?

So if there is no invoice linked to the expense, and you upload document to the expense and leave it as public document, it won’t show up for client - is that correct?

I believe that’s correct, @david may be able to confirm. `

Yes, that is correct. Expenses are not shown, unless the invoice documents toggle is switched on.

Still 404 on view/download any document

@david do you have any ideas for the 404 error? It’s affecting both the Flutter and React apps.

If neither are resolving, then the path to public/ is not the doc root.

The doc root in nginx for my install is invoiceninja/public

Are you sure, that your uploads dir is writable by the process user?

Yes, I verified that it uploaded all my PDFs into the public/storage//documents/.pdf
It uploaded them with permissions as 0664, and directory permissions in the whole invoiceninja install are 0755 (all file permissions outside the files uploaded by the app are 0644)