Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Apigee X Set Integration Request policy throwing error on JSON

I am trying to setup a POC of an Apigee X endpoint that acts as a webhook sending data into a GCP Pub/Sub topic via an integration.  I have my Integration Request Policy set as follows:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SetIntegrationRequest continueOnError="false" enabled="true" name="set-integration-request">
    <DisplayName>Set Integration Request</DisplayName>
    <ProjectId>dev-pudgy-penguin</ProjectId>
    <IntegrationName>github-webhook-pubsub2</IntegrationName>
    <IntegrationRegion>us-east1</IntegrationRegion>
    <ApiTrigger>api_trigger/github-webhook-pubsubs_API_1</ApiTrigger>>
    <Parameters>
        <Parameter name="request_body" type="json" ref="request.content"/>
    </Parameters>
</SetIntegrationRequest>

 

I'm getting the following error on that policy when looking at the debug:

 

curl -X POST https://34.160.151.177.nip.io/v1/github-webhook2 -H "Content-Type: application/json" -d @sample_github.json
{"fault":{"faultstring":"Unresolved variable : sha","detail":{"errorcode":"entities.UnresolvedVariable"}}}

 

The `request.content` is a JSON being passed in (from Github webhook) that has things like this in it:

"blobs_url": "https://git.company.com/api/v3/repos/mike-glenney/fluffy-dollop/git/blobs{/sha}"

I "think" this is what is causing the error above. I'm assuming Apigee is seeing the {} and trying to extract that as a variable.  The JSON is valid according to my linters and I'm setting type="json".

Thanks,

MG

0 5 539
5 REPLIES 5