We have observed the below error while deploying a new revision after updating the swagger definition.
TID: [-1234] [api/am/publisher] [2024-06-03 08:14:37,182] ERROR {org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO} - Failed to add API Revision entry of API UUID c6cbf692-9f2a-4299-9a5b-f46988bd00d0 java.sql.BatchUpdateException: Batch entry 0 INSERT INTO AM_API_OPERATION_POLICY_MAPPING (URL_MAPPING_ID, POLICY_UUID, DIRECTION, PARAMETERS, POLICY_ORDER) VALUES (0,'12345-5555-5555-55555-dg5t5654','request','{}',1) was aborted: ERROR: insert or update on table "am_api_operation_policy_mapping" violates foreign key constraint "am_api_operation_policy_mapping_url_mapping_id_fkey"
Detail: Key (url_mapping_id)=(0) is not present in table "am_api_url_mapping". Call getNextException to see other errors in the batch.
If we check the "API Definition" we will be able to see that after importing the updated swagger, even though we removed the "security" section it will be automatically appended to each resource by WSO2.
However, WSO2 didn't add the "x-auth-type" parameter. This is the reason for the behavior we are observing.
Thanks & Regards,
Niran Peiris
Steps to Reproduce
Set up a Postgres database. (We haven't tried the behavior in any other database type. The behavior should be the same)
Deploy and Publish the "pizzashack" API.
Add a simple mediation policy to all the resources.
Save and deploy a new revision.
Download the swagger from the "API Definition" section.
Remove the below section from all the resources in the downloaded swagger.
Description
Hi team,
We have observed the below error while deploying a new revision after updating the swagger definition.
If we check the "API Definition" we will be able to see that after importing the updated swagger, even though we removed the "security" section it will be automatically appended to each resource by WSO2.
However, WSO2 didn't add the "x-auth-type" parameter. This is the reason for the behavior we are observing.
Thanks & Regards, Niran Peiris
Steps to Reproduce
Affected Component
APIM
Version
4.2.0
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response