Search code examples
google-cloud-code

Can no longer push container image with Cloud Code


I've used Cloud Code for VS Code to deploy containers onto Cloud Run for several weeks without problems. Today I get this error:

Failed to build the app. Error: could not push image "gcr.io/my_service/my_service:latest": unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication

However I have checked my credentials and I don't believe there is any problem there. The documentation page the message points to is deprecated, presumably because Container Registry is pending deprecation, and at any rate, the solutions it offers are not related to Cloud Code. If I'm not going to use Cloud Code, then I build my container locally and then upload it to Artifact Registry.

Can anyone help with this? Is it possible to point Cloud Code to use Artifact Registry to store images?


Solution

  • can you try setting "cloudcode.useGcloudAuthSkaffold" to true in your settings.json (this setting is also visible in the settings UI)? You might need to do additional login in gcloud before proceeding but cloud code should guide you through it.