Android app doesn't pull all information

Hello,

I operate a self hosted white labeled instance of Invoice Ninja version 4.5.6. I am experiencing something strange with my Android app. It connects to my site fine and I can look up clients and contact information along with some other information but the first 2 widgets are always loading (see link 1) and if I try to view an invoice i get the red error screen seen in link 2.

link 1: https://imgur.com/TL7NQUh
link 2: https://imgur.com/a/wcepd5I

The last couple of entries on my laravel-error log are are follows. IPs and names ReDaCtEd.


object {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“ReDaCtEd”,“method”:“GET”,“user_agent”:“Dart/2.1 (dart:io)”,“locale”:“en”,“ip”:“ReDaCtEd”,“count”:1,“is_console”:“no”,“is_api”:“yes”,“db_server”:“mysql”,“url”:“api/v1/invoices”} []
[2018-12-11 14:33:01] production.ERROR: ErrorException [0] : /home4/ReDaCtEd/public_html/inv/app/Ninja/Transformers/InvoiceTransformer.php [Line 93] => Trying to get property of non-object {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“ReDaCtEd”,“method”:“GET”,“user_agent”:“Dart/2.1 (dart:io)”,“locale”:“en”,“ip”:“ReDaCtEd”,“count”:1,“is_console”:“no”,“is_api”:“yes”,“db_server”:“mysql”,“url”:“api/v1/invoices”} []
[2018-12-11 18:11:57] production.ERROR: ErrorException [0] : /home4/ReDaCtEd/public_html/inv/app/Ninja/Transformers/InvoiceTransformer.php [Line 93] => Trying to get property of non-object {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“ReDaCtEd”,“method”:“GET”,“user_agent”:“Dart/2.1 (dart:io)”,“locale”:“en”,“ip”:“ReDaCtEd”,“count”:1,“is_console”:“no”,“is_api”:“yes”,“db_server”:“mysql”,“url”:“api/v1/invoices”} []
[2018-12-11 18:12:16] production.ERROR: ErrorException [0] : /home4/ReDaCtEd/public_html/inv/app/Ninja/Transformers/InvoiceTransformer.php [Line 93] => Trying to get property of non-object {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“ReDaCtEd”,“method”:“GET”,“user_agent”:“Dart/2.1 (dart:io)”,“locale”:“en”,“ip”:“ReDaCtEd”,“count”:1,“is_console”:“no”,“is_api”:“yes”,“db_server”:“mysql”,“url”:“api/v1/invoices”} []


Has any data been manually deleted from the database?

I don’t believe so.

Try running this SQL query, any invoices listed have had their associated client deleted.

select invoice_number
from invoices i
left join clients c on c.id = i.client_id
where c.id is null;

Yup, I got 3 records returned.
INV0035
INV0040
INV0046

I’m not sure how but it looks like the clients have been deleted.

Hmmm, is there a way I could fix this or am I doomed.

To fix the mobile app you could either try to recreate the missing clients or delete the invoices.

The invoices are old and are from before I change the invoice numbering scheme. I will delete the invoices. Do I to this manually?

You’d need to delete them in the database, I’d suggest making a backup first.

Thanks Hillel, I will give that a try.

That made a difference. Invoices open and the red error screen is gone. However the 2nd widget on the dashboard doesn’t load and so does ‘Payments’ they just keep spinning.

New error in laravel-error log


[2018-12-11 21:43:58] production.ERROR: ErrorException [0] : /home4/ReDaCtEd/public_html/inv/app/Ninja/Transformers/PaymentTransformer.php [Line 66] => Trying to get property of non-object {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“ReDaCtEd”,“method”:“GET”,“user_agent”:“Dart/2.1 (dart:io)”,“locale”:“en”,“ip”:“ReDaCtEd”,“count”:1,“is_console”:“no”,“is_api”:“yes”,“db_server”:“mysql”,“url”:“api/v1/payments”} []


It looks like you also need to delete the payments associated with the invoices.

Good day Hillel, how do I locate these payments? I don’t see a dedicated payments table.

I fixed it. Was able to run a query that identified the payment and the missing client, backed up the db and deleted the entry. The mobile app seems to fully work now. All widgets generate and no red error screens so far. Thanks for all the help again.

Glad to hear it! If you’d consider leaving a review for the app we’d greatly appreciate it.

Sure, will do. ?