Response Body missing from call to API proxy although HttpStatus is 200

I have a API proxy that is a straight passthrough. When calling the backend server through Apigee I'm seeing a 200 status being returned but the response body is empty. Network trace proves that backend server is responding with a body.

Solved Solved
0 15 2,772
1 ACCEPTED SOLUTION

Case 1436673

. Apigee support figured the exception as being caused due to the backend not providing a

‘Content-Length’ or ‘Transfer-Encoding’ header in the response. Turns out the F5 in front of the backend was stripping off the Transfer-Encoding header.

.

View solution in original post

15 REPLIES 15

Can you provide a Trace session? Trace what you're seeing, then Download the trace, zip it up, and attach it here.

Not applicable

<script>alert(1)</script>

Added the trace

Seeing this in the Apigee logs -

NIOThread@1 WARN MESSAGING.FLOW - FlowDebugPoint.invoke() : Exception trying to mask value of payload

java.lang.ClassCastException: java.lang.String cannot be cast to net.minidev.json.JSONObject

at com.apigee.jsonparser.JSONUtil.contentSainity(JSONUtil.java:55) ~[jsonparser-1.0.0.jar:na]

at com.apigee.flow.debug.points.FlowDebugPoint.invoke(FlowDebugPoint.java:139) ~[message-flow-1.0.0.jar:na]

at com.apigee.flow.debug.points.AbstractFlowStateChangePoint.invoke(AbstractFlowStateChangePoint.java:44) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.dispatchToDebugService(MessageFlowImpl.java:575) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.onGoto(MessageFlowImpl.java:378) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.resume(MessageFlowImpl.java:295) [message-flow-1.0.0.jar:na]

at com.apigee.flow.execution.ExecutionContextImpl$1.run(ExecutionContextImpl.java:96) [message-flow-1.0.0.jar:na]

at com.apigee.nio.NIOSelector.runTasks(NIOSelector.java:363) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector.access$000(NIOSelector.java:34) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:311) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:302) [nio-1.0.0.jar:na]

at com.apigee.nio.util.NonNullIterator.computeNext(NonNullIterator.java:21) [nio-1.0.0.jar:na]

at com.apigee.nio.util.AbstractIterator.hasNext(AbstractIterator.java:47) [nio-1.0.0.jar:na]

at com.apigee.nio.handlers.NIOThread.run(NIOThread.java:96) [nio-1.0.0.jar:na]

added trace

tracexml.txt

Attaching trace . Please disregard the stack trace I provided earlier. That wasn't related to this trace

@Deepa,

I had a look at the trace file provided, and I agree that the Response body is empty.

1. Are you sure that you see response body in the Network trace ? If yes, can you please share the tcpdump ? If you have confidential information, then you can email the tcpdump only to me.

2. Just to re-confirm, if you make a direct call to the backend server from the Message Processor, do you see the response body ?

@AMAR DEVEGOWDA

Yes, the response body is present in the network trace. Microservice response was tapped for the call and a valid response body is present. Just an FYI- This is a new Apigee environment and I'm seeing the exact same issue with another proxy as well.

Here is the exception in the logs when additional logging is enabled

2017-12-21 13:54:51,374 org:xyz env:prod api:abc rev:4 messageid:REDACTED-31146-135234-2 NIOThread@1 WARN MESSAGING.FLOW - FlowDebugPoint.invoke() : Exception trying to mask value of payload

java.lang.ClassCastException: java.lang.String cannot be cast to net.minidev.json.JSONObject

at com.apigee.jsonparser.JSONUtil.contentSainity(JSONUtil.java:55) ~[jsonparser-1.0.0.jar:na]

at com.apigee.flow.debug.points.FlowDebugPoint.invoke(FlowDebugPoint.java:139) ~[message-flow-1.0.0.jar:na]

at com.apigee.flow.debug.points.AbstractFlowStateChangePoint.invoke(AbstractFlowStateChangePoint.java:44) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.dispatchToDebugService(MessageFlowImpl.java:575) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.onGoto(MessageFlowImpl.java:378) [message-flow-1.0.0.jar:na]

at com.apigee.flow.MessageFlowImpl.resume(MessageFlowImpl.java:295) [message-flow-1.0.0.jar:na]

at com.apigee.flow.execution.ExecutionContextImpl$1.run(ExecutionContextImpl.java:96) [message-flow-1.0.0.jar:na]

at com.apigee.nio.NIOSelector.runTasks(NIOSelector.java:363) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector.access$000(NIOSelector.java:34) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:311) [nio-1.0.0.jar:na]

at com.apigee.nio.NIOSelector$2.findNext(NIOSelector.java:302) [nio-1.0.0.jar:na]

at com.apigee.nio.util.NonNullIterator.computeNext(NonNullIterator.java:21) [nio-1.0.0.jar:na]

at com.apigee.nio.util.AbstractIterator.hasNext(AbstractIterator.java:47) [nio-1.0.0.jar:na]

at com.apigee.nio.handlers.NIOThread.run(NIOThread.java:96) [nio-1.0.0.jar:na]

There are no data masks configured either at the Org level or at the proxy level.

@Deepa,

This requires more investigation, request you to please raise a ticket with Apigee Support. We will assist you via the ticket.

@deepa,

Re Missing body in the response: check the response object used in your API proxy. If it's user defined response object then map it to "response" object.

Re Parsing error: Looks like content-type is set to "application/json" for a non JSON message.

Api proxy is just a passthrough - there are no user defined objects. The response from the backend server is a json response.

Case 1436673

. Apigee support figured the exception as being caused due to the backend not providing a

‘Content-Length’ or ‘Transfer-Encoding’ header in the response. Turns out the F5 in front of the backend was stripping off the Transfer-Encoding header.

.