Fix BuildScriptExecutor Failure on Importing Script Executors by sanjacornelius · Pull Request #6132 · ProcessMaker/processmaker
Issue & Reproduction Steps
This PR resolves a failure in the BuildScriptExecutor when importing a script executor. The issue was caused by a ModelNotFoundException occurring when the job was triggered during a database transaction.
To fix this, the queue connection configuration option afterCommit was added to the dispatch method. This ensures that the job is triggered after the database transaction is completed, preventing the ModelNotFoundException.
ci:next
ci:deploy
How to Test
Setup
- Ensure you have Guided Templates synced in your environment using php artisan processmaker:sync-guided-templates.
- Ensure that the 'Guided Python Executor' is not present in your database.
- Under 'Processes -> Guided Templates', select a template.
- Run the guided template ('Get Started') and skip the tasks ('Skip').
- When redirected to the existing assets page, select 'Continue'.
- The BuildScriptExecutor job should be triggered without any failures.
Testing:
- Create a script using the newly imported Guided Python Executor.
Example Script:
output = {
'uploadError': 'error',
'raw': 'raw data'
}
- Create a process with a script task using the above script.
3.Run the process. - Ensure there are no errors when running the script task.
Related Tickets & Packages
Code Review Checklist
- I have pulled this code locally and tested it on my instance, along with any associated packages.
- This code adheres to ProcessMaker Coding Guidelines.
- This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
- This solution fixes the bug reported in the original ticket.
- This solution does not alter the expected output of a component in a way that would break existing Processes.
- This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
- This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
- This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
- This ticket conforms to the PRD associated with this part of ProcessMaker.