microsoft / o365-moodle

Office 365 and Azure Active Directory plugins for Moodle
GNU General Public License v3.0
184 stars 138 forks source link

Group Sync Failure "Error in API call: Invalid filter clause" V3.9.8 (2020071540) #2020

Closed bbusschots-mu closed 2 years ago

bbusschots-mu commented 2 years ago

I just did a git pull on the latest stable release for Moodle 3.9 (MOODLE_39_STABLE) after getting the email notification of this morning's update. The updated plugin installed fine, but when I tried to run the group Sync task (\local_o365\task\groupcreate) after updating I got the following error:

Scheduled task failed: Create user groups in Microsoft 365 (local_o365\task\groupcreate),Error in API call: Invalid filter clause
weilai-irl commented 2 years ago

Hi @bbusschots-mu,

I didn't see this error in our testing. Could you turn on debugging and show stack trace of the error please. I'd like to know from which line of which file this was thrown.

Regards, Lai

bbusschots-mu commented 2 years ago

Hi Lai — I've already shared this with you directly, but just to keep the issue up-to-date, here is the error trace:

Execute scheduled task: Create user groups in Microsoft 365 (local_o365\task\groupcreate)
... started 09:57:02. Current memory use 13MB.
Skip creating class team for course #8138. Reason: missing Team owner
Skip creating class team for course #8139. Reason: missing Team owner
Skip creating class team for course #8140. Reason: missing Team owner
Skip creating class team for course #8141. Reason: missing Team owner
Skip creating class team for course #8142. Reason: missing Team owner
Processed courses: 5
Attempting to fetch teams
... used 19 dbqueries
... used 0.71788001060486 seconds
Scheduled task failed: Create user groups in Microsoft 365 (local_o365\task\groupcreate),Error in API call: Invalid filter clause
Backtrace:
* line 2521 of /local/o365/classes/rest/unified.php: call to local_o365\rest\o365api->process_apicall_response()
* line 1221 of /local/o365/classes/feature/usergroups/coursegroups.php: call to local_o365\rest\unified->get_teams()
* line 70 of /local/o365/classes/task/groupcreate.php: call to local_o365\feature\usergroups\coursegroups->update_teams_cache()
* line 248 of /lib/cronlib.php: call to local_o365\task\groupcreate->execute()
* line 150 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task()
weilai-irl commented 2 years ago

Hi @bbusschots-mu,

Thank you again for reporting this. I confirm this is caused by a bug in the function that constructs the Graph API call to get all Teams in the tenant to build the Teams cache. I'll fix this in an emergency release.

Regards, Lai

bbusschots-mu commented 2 years ago

I've just updated our test system form Git, and the group create task now completes successfully — thanks for the very quick turnaround on this 🙂

weilai-irl commented 2 years ago

Hi @bbusschots-mu,

Thank you for your confirmation. I have updated the release with the fix to the issue.

I'll close the issue now.

Regards, Lai