Apigee Emulator not picking up Google Service Account

Hi all,

I'm trying to deploy a proxy to my local Apigee emulator using VS code, the problem however, is that this proxy contains a Service Callout policy which requires a service account. When I try to deploy this proxy I get the following error,  "Service account must be configured with deployment when Authentication is enabled and cannot be empty".

In this post, I've read that service accounts are supported starting from emulator versions from 1.8 and above. So I updated my emulator to version 1.9.3 and I followed this tutorial to create and mount the service account credentials into the emulator container. I've reloaded VS code after all these changes, removed the container, rebuilt the container and I've verified that the credentials file is properly mounted in the Docker container. Apigee however still throws the error message mentioned above when I try to deploy it. Can anyone tell me whether I'm missing something?

The policy in question looks something like this.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ServiceCallout continueOnError="false" enabled="true" name="SC-SendToPubSub">
  <DisplayName>SC-SendToPubSub</DisplayName>
  <Properties />
  <Request clearPayload="true" variable="myRequest">
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    <Set>
      <Payload contentType="application/json">
        {
        "messages":[{
            "data":"{encodeBase64(pubsub.message)}"
            }]
        }
      </Payload>
    </Set>
  </Request>
  <Response>calloutResponse</Response>
  <HTTPTargetConnection>
    <Authentication>
      <GoogleAccessToken>
        <Scopes>
          <Scope>https://www.googleapis.com/auth/pubsub</Scope>
        </Scopes>
      </GoogleAccessToken>
    </Authentication>
    <Properties />
    <URL
  </HTTPTargetConnection>
</ServiceCallout>
The VS code configuration for Apigee looks like this.

{
"cloudcode.apigee.dockerOptions": {
   
        "environmentVariables": {
            "XTERM": "xterm-256color",
            "GOOGLE_APPLICATION_CREDENTIALS":"/emulator/keys/apigee-sa-key.json"
        },
        "dns": "8.8.8.8",
        "detached": true,
        "privileged": true,
        "labels": {},
        "volumes": {
            "/c/projects/apigee-workspace/emulator/keys":"/emulator/keys"
        },
        "additionalArguments": ""
    },
    "cloudcode.updateChannel": "Insiders"
}



Solved Solved
0 1 311
1 ACCEPTED SOLUTION

I've figured out what I was missing. After creating and mounting the service account in the emulator, you must also specify which service account is tied to the proxy in the deployments.json. This is described here.

View solution in original post

1 REPLY 1

I've figured out what I was missing. After creating and mounting the service account in the emulator, you must also specify which service account is tied to the proxy in the deployments.json. This is described here.