X-Apigee.fault-policy not working in APIGEE version 4.51

Hi,

We recently upgraded to 4.51 from 4.19. Previously X-Apigee.fault-policy was working now it has stopped. Checking was it replaced in the new release.

@adevegowda @ask4saif @dchiesa1 

Thanks

Ankita

0 6 253
6 REPLIES 6

Previously X-Apigee.fault-policy was working now it has stopped

Exactly what is that? What are you referring to there? I'm not familiar with that name.

@dchiesa1 : I referred https://www.googlecloudcommunity.com/gc/Apigee/Policy-name-that-failed/td-p/18853 post where it is written that X-Apigee.fault-policy will tell us the name of policy that has failed. And it was giving me the desired results in version 4.19

Attached screenshot of a policy from trace - screenshot is from version 4.19

ankitajain_0-1654237219192.png

Assign message policy is used to set this variable

ankitajain_1-1654237316053.png

After version upgrade I am getting a blank field 

Regards,

Ankita

Looks your custom code..

Download the trace from old version & new version .. Do a compare of the traces..

Other option is just write up simple test with similar condition & validate. It is hard to trace with minimal data provided here or share the flow/proxy bundle to review?

If you can not share here may be open a case with support for review.

 

 

Hi,

Find Attaching code here, .zip is not allowed to be add here

test123.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <Description/>
    <DefaultFaultRule name="Error Handler">
        <!-- DO NOT MODIFY -->
        <AlwaysEnforce>true</AlwaysEnforce>
        <Step>
            <Name>AM-SetFaultPolicy</Name>
        </Step>
    </DefaultFaultRule>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <Name>RF-NotFound</Name>
            </Step>
        </Request>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPProxyConnection>
        <BasePath>/test/v1</BasePath>
        <Properties/>
        <VirtualHost>default</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="default">
        <TargetEndpoint>default</TargetEndpoint>
    </RouteRule>
</ProxyEndpoint>

Code in AM-SetFaultPolicy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SetFaultPolicy">
    <DisplayName>AM-SetFaultPolicy</DisplayName>
    <Properties/>
    <Set>
        <Headers>
            <Header name="policyFailed">{X-Apigee.fault-policy}</Header>
        </Headers>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

Code in Raise Fault Policy - RF-NotFound

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RaiseFault async="false" continueOnError="false" enabled="true" name="RF-NotFound">
    <DisplayName>RF-NotFound</DisplayName>
    <Properties/>
    <FaultResponse>
        <Set>
            <Headers/>
            <Payload contentType="text/plain"/>
            <StatusCode>500</StatusCode>
            <ReasonPhrase>Server Error</ReasonPhrase>
        </Set>
    </FaultResponse>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</RaiseFault>

Whenever any error occurs AM-SetFaultPolicy policy will be called as it is in DefaultFaultRule and we should get the name of policy failed.

Regards,

Ankita

@dchiesa1 @API-Evangelist can you help?

Sorry for late response..

I downloaded the trace understood these are X-Apigee.* headers which are not-readable.

Tested to capture all headers to read but unfortunately  these are not present & are excluded.

https://docs.apigee.com/release/notes/45100-edge-private-cloud-release-notes

Due to the fix for issue 132443137 (as described in the 19.03.01 Public Cloud release notes), Message Processors now ignore headers that begin with X-Apigee-*. As a result, you must refactor any code that uses X-Apigee-* headers and replace those headers with supported ones