go auth_error ai_generated true

rpc error: code = Unavailable desc = connection closed: tls: failed to verify certificate: x509: certificate has expired or is not yet valid

ID: go/grpc-tls-certificate-expired

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-08-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.2 active

Root Cause

The TLS certificate used by the gRPC server has expired or is not yet valid.

generic

中文

gRPC服务器使用的TLS证书已过期或尚未生效。

Workarounds

  1. 95% success Renew the TLS certificate and reload the server.
    openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 365
  2. 90% success Use insecure connection temporarily for debugging.
    conn, err := grpc.Dial(address, grpc.WithInsecure())

Dead Ends

Common approaches that don't work:

  1. Restart the gRPC server without changing certificates. 100% fail

    Expired certificate remains invalid after restart.

  2. Set system time back to make certificate valid. 50% fail

    Breaks other services and is a security risk.