Flow variables dont populate consistently in PostClientFlow for same requests

sgarg24
Participant II

We are introducing Message Logging using PostClientFlow. The implementation of PostClientFlow is as follows:

  • A shared flow is invoked in PostClientFlow
  • The shared flow has 2 policies - first a JS policy to create custom log string, then a MessageLogger policy to log the same to splunk.

1) For the same request sent multiple times, both the policies execute but the flow variables are not populated and do not show up in Trace Tool either. As a result, no log entry is created. We are seeing this behavior even for consecutive 200 OK (successful) requests.

2) Another observation, which is probably by design is that for error flows, whenever a Raise Fault policy is used, flow variables from request or target response are not available. We have never seen a log entry for error scenarios with Raise Fault policy getting executed just before PostClientFlow.

1 6 190
6 REPLIES 6

Not applicable

Postclineflow is not able to execute javascript policy. I faced the same issue. you can collect all you want in logging to one flow variable and can use those in logging policy in postclient flow.

But in my case, the JavaScript policy does execute every time but populate custom variables only few times. Since there is no custom log variable populated, the logging policy does not log anything.

For me, javascript doesn't throw error, but it doesn't make the variables available. can you try using javascript in other flows instead of post client flow?

You must structure your proxy so that the JS callout to set variables happens in PostFlow, and the MessageLogging happens in PostClientFlow.

Not sure what to make of your observation regarding RaiseFault. I think I am not clear on what's going on there, or even if it is related to the issue with variables not being populated in PostClientFlow.

I am trying to create a reusable shared flow with JS policy and Message logger both executing sequentially. The shared flow is invoked in PostClientFlow.

Regarding the error scenarios, this community ticket suggests that if Raise Fault policy executes, error flow is triggered and therefore most of the request and response context variables are not available in subsequent policies.

https://community.apigee.com/questions/66861/flow-variables-not-available-in-post-client-flow.html

Not applicable

You can put your variable javascript in your fault rules so that the error related information can be logged.