Getting the errorcode "messaging.adaptors.http.flow.DecompressionFailureAtRequest"

We are making an API request with the following headers:

Content-Encoding: gzip
Accept-Encoding: gzip,deflate
Content-Type: text/xml

But we are getting the following error:

{ 
     "fault": { 
          "faultstring": "Decompression failure at request",
          "detail": {
                "errorcode": "messaging.adaptors.http.flow.DecompressionFailureAtRequest"
          }
      }
}

Can you please explain why are we getting the error "messaging.adaptors.http.flow.DecompressionFailureAtRequest" ?

Solved Solved
0 1 1,239
1 ACCEPTED SOLUTION

After investigation, it was found that if the header "Content-Encoding: gzip" is passed along with any data as part of the request, then Apigee Edge will alway try to uncompress the data passed.

In this case, the data passed was in XML (Content-Type: text/xml), which is not in gzipped format, so Apigee Edge failed with the following error as seen in the Message Processor logs:

java.util.zip.ZipException: Not in GZIP format
... 

And then Edge sends the response to the client as:

{ 
     "fault": { 
          "faultstring": "Decompression failure at request",
          "detail": {
                "errorcode": "messaging.adaptors.http.flow.DecompressionFailureAtRequest"
          }
      }
}


The solution to this issue is:

  1. If there's no need to uncompress the request payload and extract any information within the API Proxy, then the header "Content-Encoding: gzip" should not be passed as part of the request
  2. If there's a need to uncompress the request payload and extract any information within the API Proxy, then the data needs to be passed in GZIP format along with the the header "Content-Encoding: gzip"
  3. If there's a need only to uncompress and extract any information from the response from the target server within the API Proxy, then either the target server should send the header "Content-Encoding: gzip" or we could use a policy such as AssignMessage to set the header as "Content-Encoding: gzip"

View solution in original post

1 REPLY 1

After investigation, it was found that if the header "Content-Encoding: gzip" is passed along with any data as part of the request, then Apigee Edge will alway try to uncompress the data passed.

In this case, the data passed was in XML (Content-Type: text/xml), which is not in gzipped format, so Apigee Edge failed with the following error as seen in the Message Processor logs:

java.util.zip.ZipException: Not in GZIP format
... 

And then Edge sends the response to the client as:

{ 
     "fault": { 
          "faultstring": "Decompression failure at request",
          "detail": {
                "errorcode": "messaging.adaptors.http.flow.DecompressionFailureAtRequest"
          }
      }
}


The solution to this issue is:

  1. If there's no need to uncompress the request payload and extract any information within the API Proxy, then the header "Content-Encoding: gzip" should not be passed as part of the request
  2. If there's a need to uncompress the request payload and extract any information within the API Proxy, then the data needs to be passed in GZIP format along with the the header "Content-Encoding: gzip"
  3. If there's a need only to uncompress and extract any information from the response from the target server within the API Proxy, then either the target server should send the header "Content-Encoding: gzip" or we could use a policy such as AssignMessage to set the header as "Content-Encoding: gzip"