You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a workflow with a webservices step fails if the event is triggered by an external service. Consider a workflow like this:
When a new user is created, look up the user, then do a WS step calling enrol_manual_enrol_users to enroll the user in an orientation course.
It works fine if the user is creation is initiated from the front end. However if the user is created by an authentication plugin/scheduled task the WS call fails as below. I can replicate this with LDAP and external database, on Moodle 3.10 and tool_trigger 2021030406
Replication steps:
Import the attached workflow
Make sure you have a course with ID=2 (or modify workflow for a course on your site)
Manually create a user and confirm they are enrolled in the course
Create a user via LDAP or external database and confirm an error similar to below
Workflow ID: 13
Trigger Number: 373
Event description:
'User created'
'The user with id \'2\' created the user with id \'1003\'.'
[Enroll_New_User_in_Orientation_20220815_1824.zip](https://github.com/catalyst/moodle-tool_trigger/files/9339800/Enroll_New_User_in_Orientation_20220815_1824.zip)
Step ID: 851
Step results:
'{
"message": "Web service is not available. (The session has been logged out or has expired.)",
"errorcode": "servicerequireslogin",
"backtrace": "* line 228 of \\/lib\\/externallib.php: moodle_exception thrown\\n* line 116 of \\/admin\\/tool\\/trigger\\/classes\\/steps\\/actions\\/webservice_action_step.php: call to external_api::call_external_function()\\n* line 142 of \\/admin\\/tool\\/trigger\\/classes\\/steps\\/actions\\/webservice_action_step.php: call to tool_trigger\\\\steps\\\\actions\\\\webservice_action_step->run_function()\\n* line 74 of \\/admin\\/tool\\/trigger\\/classes\\/helper\\/processor_helper.php: call to tool_trigger\\\\steps\\\\actions\\\\webservice_action_step->execute()\\n* line 217 of \\/admin\\/tool\\/trigger\\/classes\\/event_processor.php: call to tool_trigger\\\\event_processor->execute_step()\\n* line 197 of \\/admin\\/tool\\/trigger\\/classes\\/event_processor.php: call to tool_trigger\\\\event_processor->process_realtime_workflow()\\n* line 109 of \\/admin\\/tool\\/trigger\\/classes\\/event_processor.php: call to tool_trigger\\\\event_processor->process_realtime_workflows()\\n* line 70 of \\/admin\\/tool\\/trigger\\/classes\\/event_processor.php: call to tool_trigger\\\\event_processor->write()\\n* line ? of unknownfile: call to tool_trigger\\\\event_processor::process_event()\\n* line 155 of \\/lib\\/classes\\/event\\/manager.php: call to call_user_func()\\n* line 75 of \\/lib\\/classes\\/event\\/manager.php: call to core\\\\event\\\\manager::process_buffers()\\n* line 834 of \\/lib\\/classes\\/event\\/base.php: call to core\\\\event\\\\manager::dispatch()\\n* line 483 of \\/auth\\/db\\/auth.php: call to core\\\\event\\\\base->trigger()\\n* line 60 of \\/auth\\/db\\/classes\\/task\\/sync_users.php: call to auth_plugin_db->sync_users()\\n* line 253 of \\/lib\\/cronlib.php: call to auth_db\\\\task\\\\sync_users->execute()\\n* line 167 of \\/admin\\/cli\\/scheduled_task.php: call to cron_run_inner_scheduled_task()\\n",
"link": "http:\\/\\/localhost\\/moodle310\\/",
"moreinfourl": "https:\\/\\/docs.moodle.org\\/310\\/en\\/error\\/webservice\\/servicerequireslogin",
"debuginfo": "\\nError code: servicerequireslogin"
```}'
The text was updated successfully, but these errors were encountered:
Using a workflow with a webservices step fails if the event is triggered by an external service. Consider a workflow like this:
It works fine if the user is creation is initiated from the front end. However if the user is created by an authentication plugin/scheduled task the WS call fails as below. I can replicate this with LDAP and external database, on Moodle 3.10 and tool_trigger 2021030406
Replication steps:
The text was updated successfully, but these errors were encountered: