Hi,
according to https://cloud.google.com/sdk/gcloud/reference/beta/code/dev
it's possible to build and run service on local machine.
To access Google Cloud Platform services with the current user's credentials following the documentation I invoke the following commands:
gcloud auth application-default login
gcloud beta code dev --dockerfile=Dockerfile --application-default-credential
However this lead to an error which says that meta data server cannot be reached:
google.auth.exceptions.DefaultCredentialsError: Neither metadata server or valid service account credentials are found.
The service works well on the cloud with same user (CloudRun by IAP).
br
Mark
Hi @mauermbq,
Welcome to Google Cloud Community!
Based on your error, you need to download a service account JSON keyfile and point it using an environment variable. Your code should look like this:
$ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"
You may want to check these documentation on authentication for additional information.
Hi robertcarlos, thank you. I'm referring to ADC: https://cloud.google.com/docs/authentication/provide-credentials-adc
AND to https://cloud.google.com/sdk/gcloud/reference/beta/code/dev
According to this
gcloud auth application-default login
generates credentials for client libraries in: `$HOME/.config/gcloud/application_default_credentials.json`
and
gcloud beta code dev --dockerfile=<path_to_dockerfile> --application-default-credential
obtains the application default credentials. So following the other docs no need for an addition env variable.