Providing service account while deploying to Apigee Emulator via VS CODE

Hi, I am trying to develop an API locally to try out this quicklabs quest - https://www.cloudskillsboost.google/focuses/32171?parent=catalog before jumping starting the lab and wasting credits trying and failing. 

This lab requires me to use google translate API as the target API back end, but after configuring the Target Connection with the following config :

<HTTPTargetConnection>
<URL>https://www.googleapis.com/auth/cloud-translation</URL>
<Authentication>
<GoogleAccessToken>
<Scopes>
<Scope>https://www.googleapis.com/auth/cloud-language</Scope>
</Scopes>
</GoogleAccessToken>
</Authentication>
</HTTPTargetConnection>

VS code gives me the following error on the console:

04/22/2022 3:04 PM EMULATOR INFO Deploying environment dev, to Container apigee-test-container (1.6.1)
04/22/2022 3:04 PM EMULATOR ERROR Code : messaging.config.beans.ServiceAccountNullOrEmptyInDeployment
04/22/2022 3:04 PM EMULATOR ERROR Message: Service account must be configured with deployment when Authentication is enabled and cannot be empty
 Error is quite obvious, I am not using a service account while deploying this service like I would have while deploying using Apigee UI, but my question is how should i provide a service account? Is there a way around it while developing things on local ?
 
This will definitely be used in my future work flow too, it will be hard for the team to only work with Apigee UI or deploy it to Apigee every time one has to make any changes to the API proxy. 
 
 
 
2 6 575
6 REPLIES 6

Unfortunately the google authentication is not available in the local emulator at this time. At this point you have to deploy your proxy to a full Apigee runtime (x or hybrid) to make use of this feature.


@strebelAny new news on that? So the only way to develop locally using Google Services like Google APIs or Secret Manager is to use the Apigee UI?!

Yes, we are making progress on the latest release of Apigee's extension for VS Code and the Apigee emulator. You should expect this to be available in the coming weeks. Here is a sneak preview of upcoming features in the new release:

  • Multi repo workspaces
  • Key stores and target server TLS
  • Service account configuration
  • Emulator configuration to support service accounts

Specifically, for your question, yes, we will support Google service accounts

Support for testing proxies which require service accounts e.g. calling a cloud logging as part of proxy flow.
- Users would be able to set up their emulators with a service account key to enable service accounts
- Add policies/ targets that rely on service accounts
- deploy these proxies into the emulator and see them in action
(prerequisites: Emulator 1.8.* and above)

Looks like it's not quite out yet. I just installed it looks to be version 1.6. Also, what about tracing/debugging with the emulator? And I'd still like to know if there's anything on the roadmap to allow deploying individual proxies from VSCode without having to use archive deployment 🙂

I can see the roadmap PDF but there doesn't seem to be anything at all with regards to developer tooling which is... upsetting...

Hi!

At this time i got 1.9.2 version of the emulator. How can you add a service account key to work locally? i can't find it.

Regards!

Hi cdenis,

You can provide an ENV variable to the docker run command like:

docker run -e GOOGLE_APPLICATION_CREDENTIALS=/emulator/keys/apigee-sa-key.json -v /your-path-where-you-have-stored-your-sa-credentials:/emulator/keys <and more other params>...

 Than you have to store your credentials of your Service Account into the file apigee-sa-key.json and put it to the right path.

The credentials could be downloaded from google cloud console.