Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Extract Variables policy working for some request and failing for others

Hi All

I am faced with a unique situation and a sev 1 prod defect. I have a Extract Variables policy for an API of the type

<dns>/online/<data-item>/<version>/validate?dataItem=<dataItemType> (PUT - application/json)

This API validates the request and in the process , it extracts an attribute (say X) from the request payload and validates it.

The issue is it works fine for most requests , but for some it just dosent execute the Extract Variables policy. It does ot thow an error , but it does not pass on control to the next policy and when I see the error it give EOF error.

I have checked the following

1) no difference in the json payloads of the requests which are successful and which are failing

2) Content-Type - application/json

3) valid json request

4) If i remove the extract variables policy for the requests which are failing , it goes into the nest policy successfully and eventually fails (it will fail ofcoruse as the variable to be validated is not extracted)

I am really confused as to how the same policy can work for an API for some requests and not for others.

Is there a restriction on the maximum payload size for this policy to work ? Also please note I have request streaming enabled on this proxy . Is it the reason that for large requests, it is not able to extract the variable ? Also I have the policy added in the target flow

@Dino

@Dino-at-Google

Solved Solved
0 4 337
1 ACCEPTED SOLUTION

If you have request streaming, you cannot examine or manipulate the payload. ExtractVariables will not work correctly. Nor will any of the other policies that operate on payloads.

I agree, it's a defect that using ExtractVariables on a PAYLOAD when streaming is enabled, does not fail more explicitly. I would expect a Fault to be raised. I haven't tested your scenario personally, but if you are observing a strange error, rather than something like "Fault, payload is not available", that sounds like a defect.

I suspect Apigee support will drop the severity of such a defect to P3, since you have an obvious workaround: don't use ExtractVariables on a payload when Streaming is enabled.

View solution in original post

4 REPLIES 4