Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API deployment fails when there are corrupted global mediation #3576

Open
niranRameshPeiris opened this issue Feb 6, 2025 · 0 comments
Open
Labels

Comments

@niranRameshPeiris
Copy link

Description

Hi team,

We have encountered an incident while deploying APIs after migrating from 3.2 to 4.2. As per the default behavior of the API Manager after migration, we have to deploy the API for the mediation sequence to migrate from the registry database to the AM_DB. Hence during the first deployment of an API after the migration, this process will take place.

As per the source code during this process, all the global sequences will be built to identify the name of the sequence. Hence the logic has been written to print an error If any exception has been caught. However, the flow may continue with the next mediation policy even though one mediation fails.

In this scenario, we have two mediations with corrupted content. Hence, we are getting the below error while deploying any of the APIs with a mediation. (Even though the corrupted mediation is not associated with the deploying API)

TID: [-1234] [api/am/publisher] [2025-02-02 04:05:12,756] ERROR {org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper} - An unknown exception has been captured by the global exception mapper. org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'l' (code 108) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)

Even though the code is written to print the error and continue with the other mediation sequences, with this error the flow fails if there is one corrupted mediation. Due to this reason, the API deployment process fails. There is no way to identify which mediation failed as well.

Thanks & Regards,
Niran Peiris

Steps to Reproduce

If you want to reproduce this issue, please follow the below steps.

  1. Start API Manager 4.2.0 server.
  2. Deply the sample PizzaShackAPI API.
  3. Login to the Carbon Management Console.
  4. Navigate to the "/_system/governance/apimgt" registry path.
  5. Then add a collection called "customsequences/in".
  6. Then navigate to this "/_system/governance/apimgt/customsequences/in" registry path.
  7. And upload two mediation sequences.

test.xml
Content:

l\uFFFD\u0355\uFFFD\u0555\uFFFD\uFFFD\u

log_request.xml
Content:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="log_request" trace="disable">
            <log level="full"/>
</sequence>
  1. Then navigate to this "/_system/governance/apimgt/applicationdata/provider/admin/PizzaShackAPI/1.0.0/api" resource path.
  2. And change the InSequence property such as below.
Image
  1. Then try to reload the API from the publisher.
  2. And deploy the API again.

Version

4.2.0

Environment Details (with versions)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant