0

I have created a PostgreSQL cloud instance with public ip. I have added my home ip into whitelist.

I have installed the cloud proxy SQL like Google doc.

When I run the proxy, I get this error:

The proxy has encountered a terminal error: unable to start: failed to get instance

private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated

The error seams refer to credential json key ID client OAuth 2.0

Can you help me to understand this error and how to fix?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dev_
  • 395
  • 1
  • 3
  • 16
  • 1
    You shouldn't need a service account key file that is a bad practice. Remove it, remove the GOOGLE_APPLICATION_CREDENTIALS env var and perform a gcloud auth application-default login to use your user account to be authenticated. In addition, Cloud SQL proxy will open a secure channel even if your personal IP is not allowed. My recommendation: set a public IP, but remove all the authorized network. It's also a a bad security practice. – guillaume blaquiere Feb 16 '23 at 15:18

1 Answers1

1

I believe the private key should be a PEM or plain PKCS1 or PKCS8; parse error: asn1: syntax error: sequence truncated is only concerned with the private_key field, rather than json in which it is contained. So it seems the key text might be mangled in some way.

You can follow this documentation how Connect to your Cloud SQL instance using SSL, then you can follow this guideline how to Configure SSL/TLS Certficates, and Connect using a MYSQL client, you can follow this and try.

or

You can follow the directions here Create and manage service account keys, could you perhaps remake a keyfile following these instructions.

Jeffrey D.
  • 414
  • 1
  • 7