Service Callout returning 404 for dev environment

I'm making a request to an API through a service callout but it keeps returning 404.

Target url : https://{target_endpoint}/api/v1/test

where target_endpoint : usdevelopment.xyz.abc.com (dev environment)

The same request when made via POSTMAN or CURL returns the expected response.

Also, the above service callout works fine for stage and prod environments where target_endpoint : stage.abc.com and prod.abc.com

Solved Solved
0 6 510
1 ACCEPTED SOLUTION

Since you are getting this in only one environment, have a look at this doc,

https://community.apigee.com/questions/57372/we-are-getting-404-response-for-all-the-apis-in-a.html

If this is an APigee ENterprise CLoud, maybe raise a ticket in,

https://apigee.com/about/support/portal

If it is on-prem then check the files yourself or get in touch with your operations team.

View solution in original post

6 REPLIES 6

Provide your Service Callout policy XML and Trace requests if possible.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Callout-Auth-Server">
    <DisplayName>Callout-Auth-Server</DisplayName>
    <Properties/>
    <Request clearPayload="true" variable="ServiceRequest">
        <Set>
            <Headers>
                <Header name="Authorization">Bearer {request.header.AUTH_TOKEN}</Header>
            </Headers>
        </Set>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    </Request>
    <Response>ServiceResponse</Response>
    <HTTPTargetConnection>
        <URL>https://{target_endpoint}/api/v1/test</URL>
    </HTTPTargetConnection>
</ServiceCallout>

Did you find anything in Trace Session?

<Point id="FlowInfo">
        <DebugInfo>
            <Timestamp>07-01-19 07:06:21:623</Timestamp>
            <Properties>
                <Property name="ServiceCallout.requesturl">https://usdevelopment.xyz.abc.com/api/v1/test</Property>
            </Properties>
        </DebugInfo>
    </Point>
    <Point id="Execution">
        <DebugInfo>
            <Timestamp>07-01-19 07:06:21:623</Timestamp>
            <Properties>
                <Property name="action">PAUSE</Property>
                <Property name="stepDefinition-async">false</Property>
                <Property name="internal">false</Property>
                <Property name="stepDefinition-type">servicecallout</Property>
                <Property name="type">ServiceCalloutExecution</Property>
                <Property name="enforcement">request</Property>
                <Property name="stepDefinition-continueOnError">false</Property>
                <Property name="stepDefinition-displayName">Callout-Auth-Server</Property>
                <Property name="stepDefinition-name">Callout-Auth-Server</Property>
                <Property name="stepDefinition-enabled">true</Property>
                <Property name="result">true</Property>
            </Properties>
        </DebugInfo>
        <RequestMessage>
            <Headers>
                <Header name="Content-Length">0</Header>
                <Header name="Host">xyz.abc.api.pqr.com</Header>
                <Header name="AUTH_TOKEN">123f12efadfadasd8asd7as1118d7as8dasdas8d7as8d</Header>
                <Header name="X-token_issuer">https://xyz.abc.api.pqr.com</Header>
                <Header name="X-user_auth_path">auth/v1/test</Header>
                <Header name="X-user_auth_server">xyz.abc.api.pqr.com</Header>
            </Headers>
            <URI>/auth/v1/test</URI>
            <Verb>POST</Verb>
        </RequestMessage>
        <VariableAccess>
            <Get name="ServiceRequest"/>
            <Get value="121dq1f12f1212f12f12f12" name="request.header.AUTH_TOKEN"/>
            <Set success="true" value="Bearer 121dq1f12f1212f12f12f12" name="ServiceRequest.header.Authorization"/>
            <Get name="ServiceRequest"/>
            <Set success="true" value="/api/v1/test" name="servicecallout.requesturi"/>
            <Get value="usdevelopment.xyz.abc.com" name="target_endpoint"/>
            <Set success="true" value="https://usdevelopment.xyz.abc.com/api/v1/test" name="servicecallout.Callout-Auth-Server.target.url"/>
            <Set success="true" value="64100" name="apigee.metrics.policy.Callout-Auth-Server.timeTaken"/>
        </VariableAccess>
    </Point>
    <Point id="Paused"/>
    <Point id="FlowInfo">
        <DebugInfo>
            <Timestamp>07-01-19 07:06:21:635</Timestamp>
            <Properties>
                <Property name="ServiceCallout.response"><!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>An error occurred.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
</body>
</html>
</Property>

I copied the target url and the required auth token from the trace and made a request to the same API using Postman and it works as expected there.

Since you are getting this in only one environment, have a look at this doc,

https://community.apigee.com/questions/57372/we-are-getting-404-response-for-all-the-apis-in-a.html

If this is an APigee ENterprise CLoud, maybe raise a ticket in,

https://apigee.com/about/support/portal

If it is on-prem then check the files yourself or get in touch with your operations team.