Skip to content

[APIM 4.6.0] Registry Path/API Name Case Mismatch Causing Publisher Swagger Update and Dev Portal Thumbnail Retrieval Failures #5107

Description

@JanithaSampathBandara

Description

Updating the Swagger/OpenAPI definition of an API via PUT /api/am/publisher/v4/apis/{apiId}/swagger REST API fails with below error.

Error : 500 Internal Server Error
{
    "code": 900967,
    "message": "General Error",
    "description": "Server Error Occurred",
    "moreInfo": "",
    "error": []
}

Carbon log shows:

ERROR - GlobalThrowableMapper Error while updating API details. Error while performing registry transaction operation.

This error is possible when the API name embedded in the registry artifact metadata does not match the API name segment present in the registry path as mentioned in below.

Registry Path:

/_system/governance/apimgt/applicationdata/provider/admin/TEST/v1

Artifact Metadata

<overview>
    <name>test</name>
</overview>

Below errors can also be observed from Dev Portal API listing operations as well when fetching the thumbnail of an API (https://localhost:9443/api/am/devportal/v3/apis/de1*****4e8/thumbnail) due to the same reason.

TID: [-1234] [api/am/devportal] ERROR {org.wso2.carbon.apimgt.rest.api.store.v1.impl.ApisApiServiceImpl} - Error while retrieving thumbnail of API : 5ce*****9c2org.wso2.carbon.apimgt.api.APIManagementException: Error while accessing thumbnail resource 
	at org.wso2.carbon.apimgt.impl.AbstractAPIManager.getIcon_aroundBody160(AbstractAPIManager.java:1756)
	at org.wso2.carbon.apimgt.impl.AbstractAPIManager.getIcon(AbstractAPIManager.java:1)
	at org.wso2.carbon.apimgt.rest.api.store.v1.impl.ApisApiServiceImpl.apisApiIdThumbnailGet(ApisApiServiceImpl.java:951)
	at org.wso2.carbon.apimgt.rest.api.store.v1.ApisApi.apisApiIdThumbnailGet(ApisApi.java:318)
	...
Caused by: org.wso2.carbon.apimgt.persistence.exceptions.ThumbnailPersistenceException: Error while loading API icon of API 5ce*****9c2 from the registry
	at org.wso2.carbon.apimgt.persistence.RegistryPersistenceImpl.getThumbnail(RegistryPersistenceImpl.java:3184)
	at org.wso2.carbon.apimgt.impl.AbstractAPIManager.getIcon_aroundBody160(AbstractAPIManager.java:1750)
	... 56 more
Caused by: org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException: Unable to extract provider from path: /apimgt/applicationdata/provider/admin/TEST/v1/api. Expected segment '/test/v1/api' not found.
	at org.wso2.carbon.apimgt.persistence.utils.RegistryPersistenceUtil.extractProviderFromPath(RegistryPersistenceUtil.java:2080)
	at org.wso2.carbon.apimgt.persistence.utils.RegistryPersistenceUtil.extractProviderFromPath(RegistryPersistenceUtil.java:2279)
	at org.wso2.carbon.apimgt.persistence.RegistryPersistenceImpl.getThumbnail(RegistryPersistenceImpl.java:3167)
	... 57 more

Steps to Reproduce

Reproducible when the API name embedded in the registry artifact metadata does not match the API name segment present in the registry path.

Version

APIM 4.6.0

Environment Details (with versions)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions