sterrenb / flutterhole

A third party Android application for the Pi-Hole® dashboard.
https://play.google.com/store/apps/details?id=sterrenburg.github.flutterhole
MIT License
400 stars 27 forks source link

fetchClientsOverTime failed with unexpected error #100

Open djh82 opened 4 years ago

djh82 commented 4 years ago

I have recently set privacy to maximum, so I'm not recording what clients are querying. Where the graph once was, is now replaced with the following warning :

{message: fetchClientsOverTime failed with unexpected error, error: type '_GrowableList<dynamic>' is not a subtype of type 'Map<dynamic, dynamic>' in type cast}

djh82 commented 4 years ago

The clients and domains tabs at the bottom, also suffer from this.

sterrenb commented 4 years ago

Hello @davidhart82 👋 - Thanks for opening an issue!

Sounds like the requests that require authentication are failing. Could you try out the following URL in your browser (adjust as necessary and add your API token):

http://pi.hole/admin/api.php?getClientNames&auth=MY_TOKEN

A successful response yields some JSON data. If authentication fails, you should see something like [ ].

djh82 commented 4 years ago

Everything else works; its because there is no data available due to enhanced privacy settings. I will run that when I am at home later tonight though for you!

djh82 commented 4 years ago

This is what is returned:

{"clients":[]}

It looks like _valueToHitsOverTime is casting an empty list to a map, which causes the error?

sterrenb commented 4 years ago

{"clients":[]}

That seems like a normal response... I will look into handling empty lists more gracefully, that seems to be the culprit.

hey24sheep commented 4 years ago

I'm facing this same issue. This same issue occurs on client page and query page also if your pi is offline it occurs there too.