I did a quick analysis. A record is getting inserted into the external_services_logs table with institution = "".
Which means, that the $WEBSERVICE_INSTITUTION variable is not getting set correctly when the user is getting authenticated. There are 3 places where this happens: 1. htdocs/webservice/lib.php:authenticate_user() line 946 <- not the issue as all data is correct in the usr / usr_institution tables. 2. htdocs/webservice/lib.php:authenticate_user() line 1001 <- not likely. 3. htdocs/webservice/lib.php:authenticate_by_token() line 1084 <- most likely is the issue. I think it's in the authenticate_by_token() because when I did a query of the external_tokens table, the institution field was empty (not null but ""). It would be good to know the steps used when accessing the site via the webservice. -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1694909 Title: Webservices log shows errors Status in Mahara: Confirmed Bug description: seen on Mahara 17.04 with an upgraded database and 1 Mahara 17.04 with a few users, but not on 17.10master with a fresh database When going to the Web services logs, I get the following error message: [WAR] 77 (lib/errors.php:859) Failed to get a recordset: postgres8 error: [-1: ERROR: syntax error at end of input LINE 1: SELECT "displayname" FROM "institution" WHERE "name" = ? ^] in EXECUTE("SELECT "displayname" FROM "institution" WHERE "name" = ? ")Command was: SELECT "displayname" FROM "institution" WHERE "name" = ? Call stack (most recent first): log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /home/kristina/code/1704stable/htdocs/lib/errors.php:95 log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1704stable/htdocs/lib/errors.php:859 SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /home/kristina/code/1704stable/htdocs/lib/dml.php:517 get_recordset_sql("SELECT "displayname" FROM "institution" WHERE "na...", false) at /home/kristina/code/1704stable/htdocs/lib/dml.php:828 get_field_sql("SELECT "displayname" FROM "institution" WHERE "na...", array(size 0)) at /home/kristina/code/1704stable/htdocs/lib/dml.php:816 get_field("institution", "displayname", "name", null) at /home/kristina/code/1704stable/htdocs/lib/institution.php:997 institution_display_name(null) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:222 get_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:39 build_webservice_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicelogs.php:53 [WAR] 77 (lib/dml.php:517) Failed to get a recordset: postgres8 error: [-1: ERROR: syntax error at end of input LINE 1: SELECT "displayname" FROM "institution" WHERE "name" = ? ^] in EXECUTE("SELECT "displayname" FROM "institution" WHERE "name" = ? ")Command was: SELECT "displayname" FROM "institution" WHERE "name" = ? Call stack (most recent first): get_recordset_sql("SELECT "displayname" FROM "institution" WHERE "na...", false) at /home/kristina/code/1704stable/htdocs/lib/dml.php:828 get_field_sql("SELECT "displayname" FROM "institution" WHERE "na...", array(size 0)) at /home/kristina/code/1704stable/htdocs/lib/dml.php:816 get_field("institution", "displayname", "name", null) at /home/kristina/code/1704stable/htdocs/lib/institution.php:997 institution_display_name(null) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:222 get_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicessearchlib.php:39 build_webservice_log_search_results(object(stdClass)) at /home/kristina/code/1704stable/htdocs/webservice/admin/webservicelogs.php:53 To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1694909/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : [email protected] Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp

