Finalizing unprovision workflow task fails with the following error:
Task ID 1000000 Queue name aps_application_instance1000 Task name APS application 'APPNAME', id 100, instance 1000 -> service 'SERVICENAME', instance 10000: finalizing unprovision workflow Last execution output Internal error: SDK::Platform::blob Plesk::SaaS::SaaSManagerTasks_impl::taskExecuteWorkflowUnprovisionAPS1x(const SDK::Platform::Properties&) : [APSC] ODBC code #HY000: ERROR: update or delete on table "aps_resource" violates foreign key constraint "FK_aps_resource_link_target_resource" on table "aps_resource_link"; Error while executing the query.
A database inconsistency caused by canceled tasks. Service instance with ID 10000 was required by another service instance.
Find ID of the resource corresponding to the service instance that is being removed:
SELECT id FROM aps_resource WHERE registry_object_id = (SELECT id FROM aps_registry_object WHERE uid = (SELECT uuid FROM aps_service_instances WHERE service_instance_id = 10000)); id | 20000
Find ID of the source resource:
SELECT source_resource_id FROM aps_resource_link WHERE target_resource_id = 20000; source_resource_id | 30000
Find the service instance ID corresponding to this resource:
SELECT service_instance_id FROM aps_service_instances WHERE uuid = (SELECT uid FROM aps_registry_object WHERE id = (SELECT registry_object_id FROM aps_resource WHERE id = 30000)); service_instance_id | 40000
- Check if any tasks to remove the service instance 40000 were scheduled. If so, cancel the initial task temporarily. Then, once tasks related to service instance 40000 are processed, re-run the canceled task.