API portal sync failure due to folder constraint
search cancel

API portal sync failure due to folder constraint

book

Article ID: 276555

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

When attempt to import the new created API from portal to gateway, the gateway fails to save the bundle of the API to database with following error,

023-11-15T17:06:04.834+0800 WARN    804 org.hibernate.engine.jdbc.spi.SqlExceptionHelper: SQL Error: 1452, SQLState: 23000
2023-11-15T17:06:04.834+0800 ERROR   804 org.hibernate.engine.jdbc.spi.SqlExceptionHelper: Cannot add or update a child row: a foreign key constraint fails (`ssg`.`published_service`, CONSTRAINT `published_service_folder` FOREIGN KEY (`folder_goid`) REFERENCES `folder` (`goid`))
2023-11-15T17:06:04.834+0800 WARNING 804 com.l7tech.server.bundling.EntityBundleImporter: Error importing bundle on processing mapping 2 of 2. Mapping: EntityHeader. Name=***, id=***, description=null, type = POLICY
Error attempting to save or update the Policy with id = '***'.  Constraint Violation: could not execute statement
2023-11-15T17:06:04.841+0800 INFO    804 com.l7tech.server.bundling.EntityBundleImporter: Error importing bundle (1/1)
2023-11-15T17:06:04.877+0800 WARNING 804 com.l7tech.server.policy.assertion.ServerAuditDetailAssertion: -5: Failed to sync Portal API services

Cause

The error indicates that the folderid of "Portal APIs" folder is not matching the cluster wide property "portal.api.folder", so that the new API cannot save to gateway due to the folder id constraint.

It could be due to the gateway was enrolled to another portal.

Resolution

1. A quick work around is to manually update the cwp portal.api.folder with correct folderid

- login policy manager

- right click the folder "Portal APIs", select "Folder Properties" to show the folder id, record this folder id

- Navigate to "Tasks" menu > "Global Settings" > "Manage Cluster-Wide Properties" > Edit the "portal.api.folder" property, (the current value of "portal.api.folder" should be different with the recorded folder id), set it as the folder id just recorded 

- Make a small change on the new API on portal to trigger the sync activity, this time it should be able to sync to the gateway.

 

2. It's data issue with portal integration on the gateway, a more common solution is to re-enroll the gateway.

If the solution 1 cannot fix the issue, please refer to the document,

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-developer-portal/5-2/install-configure-and-upgrade/post-installation-tasks/enroll-a-layer7-api-gateway.html

ie.

a. clean up old portal integration first,

look for key word "To clean up the API Gateway" in above product document, there are 6 steps to clean up the gateway-portal integration.

b. remove the gateway( under Proxies page ) on portal 

c. enroll the gateway as per above product document.