Empty response in post-flow policy for transfer-encoding: chunked

I have Apigee X proxies in front of some target servers returning the response as transfer-encoding: chunked. I have response.streaming set to false for the target endpoints. I try to read the contents of the response (response.content) in Javascript / AssignMessage/ExtractVariables policy. Unfortunately most of the time it returns empty response. It happens with the servers provided by multiple vendors so I don’t suspect the problem on the target server side. At times (rarely) it actually works fine so it looks like race-condition - the data is not fully buffered before Apigee proceeds to post-flow policies. Any hints?

Hi @tomekem_yh, welcome to the Apigee forums! We are incredibly excited to have you join our community :rocket:

We encourage our community members and experts to chime in with their knowledge and hints for your setup, we wanted to make sure you have some resources to look over in the meantime, you might find our community resources valuable:

You are also invited to join our Community Techtalks; we’re hosting a session this Thursday, May 28, covering the Apigee Production Go-Live Checklist. It’s happening at 5 PM CEST | 11 AM EDT. Please register here—we would love to have you there!

Hi @tomekem_yh - thanks for reaching out, the only way to work with streaming payloads is to use the EventStream feature, see docs here: Streaming server-sent events  |  Apigee  |  Google Cloud Documentation.

Per my understanding, there are 2 types of streaming:

  • “Content-type: text/event-stream” - handled by event stream in Apigee
  • “Transfer-encoding: chunked” - not handled by event stream in Apigee but like regular response

Is it correct?

Yes that’s correct, EventFlow just handles SSE text/event-stream.