Forums | Mahara Community

Support /
Problems with Mahara Mobile - Cannot connect


Kali Graf's profile picture
Posts: 6

23 September 2021, 20:26

Hi all,

i have a strange Problem with the Mahara Mobile App on our Mahara installation 20.10.0

 

I tried out the Mobile App however it tells me that my Username/PW is not right.

So I went on the appache logs on the Server.

If I on purpose type in the wrong PW I get the following which seems like expected behavior to me (its a German instalation)

[Tue Sep 21 16:12:13.944355 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952] [WAR] a5 (module/mobileapi/json/token.php:94) Login fehlgeschlagen. Bitte \xc3\xbcberpr\xc3\xbcfen Sie Ihr Nutzername und Passwort. : Fehler bei der Anmeldung. Bitte kontrolliere den Benutzernamen und das Passwort.
[Tue Sep 21 16:12:13.944405 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952] Call stack (most recent first):
[Tue Sep 21 16:12:13.944419 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952]   * log_message(string(size 156), integer, true, true, string(size 68), integer, array(size 0)) at /var/www/foobar.foobar.org/htdocs/lib/errors.php:642
[Tue Sep 21 16:12:13.944426 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952]   * MaharaException->handle_exception() at /var/www/foobar.foobar.org/htdocs/lib/errors.php:541
[Tue Sep 21 16:12:13.944432 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952]   * exception(object(WebserviceException)) at Unknown:0
[Tue Sep 21 16:12:13.944437 2021] [php7:notice] [pid 7937] [client xx:xx:xx:xx:39952]

 

 

If I type in the correct PW the App still tells me that my user/PW is wrong, the server logs however show me the following:

[Tue Sep 21 16:13:12.430512 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953] [DBG] 85 (webservice/lib.php:1520) executing: module_mobileapi_sync/sync
[Tue Sep 21 16:13:12.452350 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953] [WAR] 85 (lib/errors.php:853) Failed to get a recordset: postgres8 error: [-1: ERROR:  invalid input syntax for type numeric: "0,070630788803101"] in EXECUTE("INSERT INTO "external_services_logs" ("id", "timelogged", "userid", "externalserviceid", "protocol", "auth", "functionname", "timetaken", "uri", "info", "ip") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")Command was: INSERT INTO "external_services_logs" ("id", "timelogged", "userid", "externalserviceid", "protocol", "auth", "functionname", "timetaken", "uri", "info", "ip") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and values was (id:81,timelogged:1632233592,userid:22,externalserviceid:3,protocol:REST,auth:OTHER,functionname:module_mobileapi_sync,timetaken:0,070630788803101,uri:/webservice/rest/server.php?alt=json,info:,ip:xx:xx:xx:xx)
[Tue Sep 21 16:13:12.452393 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953] Call stack (most recent first):
[Tue Sep 21 16:13:12.452407 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]   * log_message(string(size 793), integer, true, true) at /var/www/foobar.foobar.org/htdocs/lib/errors.php:89
[Tue Sep 21 16:13:12.452418 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]   * log_warn(string(size 793)) at /var/www/foobar.foobar.org/htdocs/lib/errors.php:853
[Tue Sep 21 16:13:12.452428 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]   * SQLException->__construct(string(size 793)) at /var/www/foobar.foobar.org/htdocs/lib/dml.php:1236
[Tue Sep 21 16:13:12.452437 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]   * insert_record(string(size 22), object(stdClass), string(size 2), true) at /var/www/foobar.foobar.org/htdocs/webservice/lib.php:1410
[Tue Sep 21 16:13:12.452447 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]   * webservice_base_server->run() at /var/www/foobar.foobar.org/htdocs/webservice/rest/server.php:75
[Tue Sep 21 16:13:12.452473 2021] [php7:notice] [pid 4433] [client xx:xx:xx:xx:39953]


So it seems to me that the authentication works but fails on another point. I blacked the IP with xx but please notice that the port afterwards is changing.
Any guidance/help on how to debug this is highly appreciated.

Many thanks
Stephan

Kristina Hoeppner's profile picture
Posts: 4729

27 September 2021, 8:57

Hi Stephan,

What authentication method do you have on your site? On what mobile device are you trying to connect? Android or iOS? And which version?

Thank you

Kristina

Kali Graf's profile picture
Posts: 6

27 September 2021, 21:16

We use basic user accounts, no ldap, sso or others.

I tried both, iOS and Android, however with iOS the Apache reply was not as detailed as with Andoid.

I run App Version 21.04.2 on Android with which above error message is created.

Many Thanks.

Stephan

 

Kali Graf's profile picture
Posts: 6

30 September 2021, 7:47

Hi, I would like to update on the case.

I found a work around on the problem, however I feel its more like a bug report but we can discuss here before filing one..

Following the stack trace, the error message is in fact is quit clear. A float is tried to be parsed as int.

Changing the variable "time_taken" in file:

/var/www/talente.kickfair.org/htdocs/webservice/lib.php

from

 $time_taken = $time_end - $WEBSERVICE_START;

to

 $time_taken = 1;

for testing purpose allowed me to log in via mahara mobile as expected.

 

However, I am not keen on running a manually patched version. I failed trying to understand where the error comes from but my best guess is a wrong variable declaration or a database scheme expecting an int instead of a float.

 

Can this be passed along to the dev people. Thx

 

Best Stephan

 

Update:

I have been able to produce another exeption:

 

PHP Fatal error:  Uncaught SQLException: Failed to get a recordset: postgres8 error: [-1: ERROR:  invalid input syntax for type numeric: "0,12291693687439"] in EXECUTE("INSERT INTO "external_services_logs" ("id", "timelogged", "userid", "externalserviceid", "protocol", "auth", "functionname", "timetaken", "uri", "info", "ip") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")Command was: INSERT INTO "external_services_logs" ("id", "timelogged", "userid", "externalserviceid", "protocol", "auth", "functionname", "timetaken", "uri", "info", "ip") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and values was (id:109,timelogged:1632941361,userid:23,externalserviceid:3,protocol:REST,auth:OTHER,functionname:module_mobileapi_upload_blog_post,timetaken:0,12291693687439,uri:/webservice/rest/server.php?alt=json,info:exception:SQLExceptionmessage:Failedtogetarecordset:postgres8error:[-1:ERROR:invalidinputsyntaxfortypenumeric:"0,11438679695129"]inEXECUTE("INSERTINTO"external_services_logs"("id","timelogged","userid","externalserviceid","protocol","auth" in /var/www/talente.kickfair.org/ht

 

From this I would like to point out the following to variables:

timelogged: 1632941361

timetaken:   0,12291693687439

So it seems to me that treating time(stamps) in two different format causes the error.

I wonder why this seems to be a problem in our installation, which I took over from a colleague. It this is a real bug everyone should fail to log in with Mahara Mobile. Clarification form Dev is highly appreciated. Thx in advance

Stephan

 

 

 

 

 

 

Kristina Hoeppner's profile picture
Posts: 4729

30 September 2021, 8:33

Hi Kali,

Which version of Android do you have please?

Thank you

Kristina

Kali Graf's profile picture
Posts: 6

30 September 2021, 21:37

Hi, I don't have it here right now to check the exact version. I might be a little outdated.

However I am facing the same problem with iOS as stated above. Here I run iOS 14.7.1 with the App available via the App Store (Version 21.04.1).

My understanding from the source code is, that the problem happens server side, so it would be independent from App/Android

Version, since it calculates the times from system time. No information from the app is involved at the point of failure.

Best

Stephan

 

 

Kali Graf's profile picture
Posts: 6

04 October 2021, 6:55

Hi Kristina,

do you have any suggestions on how to proceed. We would like to use the mobile app functionality,

Many thanks in advance.

Stephan

 

Doris ⚡'s profile picture
Posts: 84

06 October 2021, 12:03

Hi Stephan,

We made a bug report for your issue. The database currently only accepts the English format for floats i.e. '1,5' isn't recognised as a float yet. Some work will need to be done to deal with multiple formats of floats.


Kind regards,

Doris

Kali Graf's profile picture
Posts: 6

07 October 2021, 5:56

Hi Doris,

yes that makes sense to me. Thanks for filing the bug.

In the meantime is, there a way to get an running installation with what we have now. Does it help to change language or does it come from the system time ? It would be nice to have a workaround coming from system/mahra settings with no need to chance the source code as I did before.

Thx

Stephan

Doris ⚡'s profile picture
Posts: 84

18 October 2021, 13:17

Hi Stephan,


Are you able to figure out which of the variables $time_end and $WEBSERVICE_START is the comma-separated float?
At this point, we're not sure which one of these variables are bringing in the float number.


For now, you could try putting $time_taken through a str_replace or preg_replace as these people have done on stackoverflow to replace the comma with a dot so that the database will recognise the decimal.

What PHP version and database are you running?


Kind regards
Doris

11 results