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

Exposing GRPC backend as Rest Apigee X proxy

Hi ,

I want to expose a publicly available GRPC app as a REST api on Apigee X.

I created the Target Server as gRPC - External callout type and linked it to the ExternalCallout policy like 

<ExternalCallout continueOnError="false" enabled="true" name="EC-GRPC">
  <DisplayName>EC-GRPC</DisplayName>
  <GrpcConnection>
    <Server name="postman-echo"/>
  </GrpcConnection>
  <TimeoutMs>5000</TimeoutMs>
  <Configurations>
    <Property name="with.request.content">true</Property>
    <Property name="with.request.headers">true</Property>
    <Property name="with.response.content">true</Property>
    <Property name="with.response.headers">true</Property>
    <FlowVariable>example.flow.variable</FlowVariable>
    <FlowVariable>another.flow.variable</FlowVariable>
  </Configurations>
</ExternalCallout>
 
I'm getting this error -
{
    "fault": {
        "faultstring": "Encountered the following exception while sending the gRPC request or processing the response: [io.grpc.StatusRuntimeException: UNIMPLEMENTED: The server does not implement the method /apigee.ExternalCalloutService/ProcessMessage].",
        "detail": {
            "errorcode": "steps.externalcallout.ExecutionError"
        }
    }
}
 
Does this mean I should add more code into the server app to accept apigee rpc calls?
Is there any way to hit the grpc app using server reflection like grpcurl does?
What is the correct way to do this?
0 3 266
3 REPLIES 3

Do you have the full working request in a third party tool, and have you compared it to what Apigee sends (via debug, etc)?

I am wondering if Apigee is adding on the resource path when proxying to your backend service, which you can easily remove via something as follows:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-Set-Path-Suffix">
<DisplayName>AM-Set-Path-Suffix</DisplayName>
<AssignVariable>
<Name>target.copy.pathsuffix</Name>
<Value>false</Value>
</AssignVariable>
</AssignMessage>

 

Hi @ArunavaP, just checking in to see if @hartmann's suggestion helped resolve your question. If the provided guidance was helpful, marking it as an accepted solution would be great for others facing similar challenges. 🙂

Hi Aruna!

The External Callout policy requires a specific gRPC proto implementation. This feature may only be helpful for you if you're open to implementing this Apigee proto on the server side.

Based on your use case, I believe you're looking for gRPC transcoding. This isn't formally supported by Apigee yet. Currently, Apigee only supports gRPC as passthrough (streaming request and response).

While gRPC transcoding isn't natively supported, you could inspect the binary gRPC payload (request or response) and decode it using a proto file and this sample Java Callout.

Let us know if you have any further questions.