skip to Main Content

I am attempting to run a Cloud Run container locally in VSCode via Cloud Code, but the trying to build it fails every time due to the following errors:

Waiting for deployments to stabilize...
 - ...: container cloud-sql-proxy terminated with exit code 1
    - ...: container cloud-sql-proxy terminated with exit code 1
      > Error retrieving logs for pod ...: exit status 1.
Try `kubectl logs d... -n default -c cloud-sql-proxy`

Running kubectl logs d... -n default -c cloud-sql-proxy gives me the following output:

E0228 10:35:09.202560    9698 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:53943/api?timeout=32s": dial tcp 127.0.0.1:53943: connect: connection refused
E0228 10:35:09.202732    9698 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:53943/api?timeout=32s": dial tcp 127.0.0.1:53943: connect: connection refused
E0228 10:35:09.203867    9698 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:53943/api?timeout=32s": dial tcp 127.0.0.1:53943: connect: connection refused
E0228 10:35:09.203994    9698 memcache.go:265] couldn't get current server API group list: Get "https://127.0.0.1:53943/api?timeout=32s": dial tcp 127.0.0.1:53943: connect: connection refused
The connection to the server 127.0.0.1:53943 was refused - did you specify the right host or port?

Any advice would be appreciated.

I am on a Mac M1 chip and my Cloud Run container is built with Dockerfile, in case that matters

2

Answers


  1. Thanks for bringing this to our attention.
    But unfortunately, there is no way to get Cloud SQL proxy running locally since there is no metadata server.

    Please allow us sometime to get back with a recommended way to do this.

    Update: You need to deploy to Cloud Run inorder to use the SQL Proxy. Cloud Run Emulator will not (likely will not) support SQL Proxy. Thanks.

    Login or Signup to reply.
  2. I am an engineer on the Cloud Code team.

    Local Cloud Run happens on a minikube profile named "cloud-run-dev-internal". We clean up after ourselves by deleting the deployment and pausing the minikube profile as soon as the session ends, and the session ends after your failure. Normally, the errors show up in the logs we output, but unfortunately this is not the case this time because it is in another container.

    You can’t get the logs because the cluster is stopped, and even if the cluster was not stopped you would find the deployment deleted.

    Apologies for this being kinda hacky (we will look at providing better debug options in the future). Here’s what I would recommend to see the logs for now:

    • Start your run/debug on Cloud Run emulator session.
    • As soon as you see the deployment status checking, CLOSE your VS Code window. This will prevent the detected failure deleting the deployment.
    • With the minikube profile still running this time, you can run your logs command in another terminal. For example: kubectl logs {{container name}} -c cloud-sql-proxy.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search