Payload compression in Apigee Edge

I've a large (~600KB) request payload that I'd like to compress in Apigee and store in a KVM. I've followed this and this posts but gzip compression does not seem to be working in my AssignMessage policy. Here's how I've coded my AM policy, but when I see the trace I see the same content length before and after the AM policy.

    <Set>
        <Headers>
            <Header name="Content-Encoding">gzip</Header>
        </Headers>
    </Set>
    <AssignVariable>
        <Name>myvar</Name>
        <Ref>request.content</Ref>
        <Value>ErrorOnCopy</Value>
    </AssignVariable>

In trace Before AM policy

Request Headers
  Accept-Encoding gzip,deflate,br
  Content-Length 600000
  Content-Type text/plain

In trace After AM policy

Request Headers
  Accept-Encoding gzip,deflate,br
  Content-Encoding gzip
  Content-Length 600000
  Content-Type text/plain

I get a "Datastore Error" from the KVM policy which is the same error if I try to call just the KVM and add the payload. The error goes away if I reduce the payload size and KVM gets updated correctly; so I'm guessing the compression to gzip isn't working.

Can someone please let me know what I might be doing wrong?

0 2 368
2 REPLIES 2

You should firstly note the product limits, and the limits on KVM

There's a limit of 10kb on a KVM Value

https://docs.apigee.com/api-platform/reference/limits

That was my first thought; I did not expect the KVM to get populated beyond a message limit of 10 KB. But I'm able to add and retrieve KVM values as large as up to 500 KB.