ncstate-delta / moodle-mod_zoom

Moodle plugin for Zoom meeting
https://moodle.org/plugins/mod_zoom
61 stars 106 forks source link

Failing scheduled task #607

Open jwalits opened 1 month ago

jwalits commented 1 month ago

We're constantly getting this error. It feels like the scheduled task should handle this failure a bit more gracefully rather than having to disable the scheduled task manually.

Scheduled task failed: Get meeting report from Zoom (mod_zoom\task\get_meeting_reports),Zoom received a bad request: This API is only available for ZMP and Business or higher accounts that have enabled the Dashboard feature.
Backtrace:
 * line 359 of /mod/zoom/classes/webservice.php: call to mod_zoom\webservice->make_call()
 * line 976 of /mod/zoom/classes/webservice.php: call to mod_zoom\webservice->make_paginated_call()
 * line 430 of /mod/zoom/classes/task/get_meeting_reports.php: call to mod_zoom\webservice->get_meetings()
 * line 159 of /mod/zoom/classes/task/get_meeting_reports.php: call to mod_zoom\task\get_meeting_reports->get_meetings_via_dashboard()
 * line 410 of /lib/classes/cron.php: call to mod_zoom\task\get_meeting_reports->execute()
 * line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
 * line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
 * line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()
jrchamp commented 1 month ago

Hi @jwalits,

The message from Zoom is saying that your account does not have permissions to use the Dashboard APIs. The plugin handles this by checking if the Dashboard scope has been granted: https://github.com/ncstate-delta/moodle-mod_zoom/blob/aa8208402f29574cbecd8de594ce520646c5ec36/classes/task/get_meeting_reports.php#L146-L158

If you remove the Dashboard scopes from your Marketplace App, it should fix the error. Please let us know if the Marketplace app does not have those scopes granted and you continue to encounter the error.

jwalits commented 1 month ago

Thanks @jrchamp - I'll reach out to the team internally and see if they can remove that scope from the App. I dont have the access to the zoom side of things yet!

Thanks again for the quick feedback.

jwalits commented 1 month ago

Hey @jrchamp

I've been able to login and check the marketplace app. I have deleted the Dashboard scopes from that app and now we are seeing a different error

 Scheduled task failed: Get meeting report from Zoom (mod_zoom\task\get_meeting_reports),Zoom received a bad request:
 Invalid access token, does not contain scopes:[dashboard_meetings:read:admin, dashboard:read:admin].
jrchamp commented 3 weeks ago

All of the Dashboard API endpoints start with metrics/. So it's trying to make a request to an endpoint that claims that it needs a dashboard scope. Either the plugin is incorrectly making a Dashboard API call even though the Dashboard scopes are gone or the API is returning incorrect information.

Here's my hopeful guess: Maybe the scopes were cached and the cache wasn't cleared when the Marketplace app was updated. If it's working now, that's the most likely explanation, because the cache should have automatically expired by now.

Are you still getting the same error? If so, then someone will need to enumerate all of the API calls that might be made and verify that Zoom's API is checking the correct set of scopes.

jwalits commented 2 weeks ago

Hey @jrchamp

Apologies for the delay in getting back to you. I haven't had a chance to re-check that in the last few days. I actually disabled that task for now on the site - as it wasn't really needed and kept pinging our monitoring creating an alert.

I'll re-check hopefully in the next few days to see if its still happening.