JGeek00 / droid-hole

Pi-hole® client made with Flutter
Apache License 2.0
135 stars 11 forks source link

Unknown Error #10

Closed blahdidbert closed 1 year ago

blahdidbert commented 1 year ago

Hello,

Whenever I put in the information, I receive "Failed: Unknown Error". Putting in other information into the subroutine shows "Failed: API Key is invalid."

Is there a way to get more details of the error messages?

Droidhole Version: v3.1.2 Pi-hole: v5.14.2 FTL: v5.20 Web Interface: v5.18

JGeek00 commented 1 year ago

Do you have any special configuration (reverse proxy or similar)? Unfortunately I didn't implemented a logging system on this app.

Make sure that on the top of the new connection screen you have the exact same URL as you use for the web admin panel.

blahdidbert commented 1 year ago

No special implementation and everything is hitting the way it should. Do we have any recommendations on further troubleshooting?

Below are some examples of it helps.

Screenshot_20221224-102647 Screenshot_20221224-102658

Token is good which is making this weirder for me. If we don't have any other routes, no worries at all.

JGeek00 commented 1 year ago

I would need to add a logging system to know what's happening.

JGeek00 commented 1 year ago

I have pushed a new build to Google Play. I don't know if Google will approve it soon because this days are different. If you want to get the update now, you can download the apk from the releases section of the repository. Also you don't need to add the /admin on path.

Just after seeing an error on the login screen, go to Settings > Advanced settings > App logs and tap on the share button. This will copy the logs into the clipboard, then paste it here.

robaudis commented 1 year ago

I noticed my app started failing to connect to a previously configured pihole that was working correctly. It now fails to add in the same manner as described in this issue. I have my pihole running in a docker container which automatically updates (not really best practice I know). Perhaps this PR is relevant as it was included in the latest release https://github.com/pi-hole/AdminLTE/pull/2411 ?

Fwiw the logs from the latest version are: [{"type":"login","dateTime":"2022-12-24 20:30:42.815426","message":"type '_OneByteString' is not a subtype of type 'int' of 'index'","statusCode":"null","resBody":"null"}]

JGeek00 commented 1 year ago

Could you send me what are you receiving from this endpoint [base url]/admin/api.php and from this endpoint [base_url]/admin/api.php?auth=${server.token}&enable=0?

blahdidbert commented 1 year ago

Screenshot_20221224_183920 Screenshot_20221225_000719

robaudis commented 1 year ago

From the first URL I get: []

From the second, with my API token I get: {"status":"enabled"}

JGeek00 commented 1 year ago

Screenshot_20221224_183920

Screenshot_20221225_000719

On the first URL you have to remove the first $ (if it's not included in the API token string). The second response is strange. It should return some data even if you are not authenticated. Maybe it's has relation with the PR that you linked yesterday.

JGeek00 commented 1 year ago

From the first URL I get:

[]

From the second, with my API token I get:

{"status":"enabled"}

That's weird. You are not receiving anything from the base endpoint. Try calling that same endpoint but adding ?auth=[your token].

blahdidbert commented 1 year ago

I am getting the same response as @robaudis after I corrected the query.

Screenshot_20221225_080718

robaudis commented 1 year ago

With the first URL and appending the auth parameter I get the same response: []

JGeek00 commented 1 year ago

Please try with this URL replacing server_address and token.

[server_address]/admin/api.php?auth=[token]&summaryRaw&topItems&getForwardDestinations&getQuerySources&topClientsBlocked&getQueryTypes

JGeek00 commented 1 year ago

Please try this version and let me know if it's fixed.

app-release.apk.zip

robaudis commented 1 year ago

That version seems to be working, I can connect to my pihole now. All functions are working as far as I can tell.

Thank you for taking the time to fix this, especially over the holidays. However/whatever you celebrate, I hope it has been good.

JGeek00 commented 1 year ago

Glad to read that!

Thank you for using the app and hope you are enjoying it. Merry Christmas and enjoy this holidays with your family and friends :-)

JGeek00 commented 1 year ago

Fixed on v3.1.4.