使用 Firestore 在 Cloud Run 上连接 Golang 应用程序的问题

mar*_*aak 3 firebase google-cloud-run

我尝试使用以下函数从 Firestore 获取所有文档。

凭据存储在 GCP Cloud Source 存储库中的加密文件中。我解密了 Cloud Build 触发器中的配置,并在指向该文件的 Dockerfile 中设置了 ENV。我通过 RUN ls /app/credentials.json 看到内容。

我在应用程序日志中得到的错误:rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: authentication handshake failed: x509: certificate signed by unknown authority"

凭据存储在 GCP Cloud Source 存储库中的加密文件中。我解密了 Cloud Build 触发器中的配置,并在指向该文件的 Dockerfile 中设置了 ENV。我通过 RUN ls /app/credentials.json 看到内容。

我在应用程序日志中得到的错误: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: authentication handshake failed: x509: certificate signed by unknown authority"

Gra*_*ide 7

此错误是无法验证证书的 HTTPS 故障的结果。的高山基本图像缺少包,提供根证书。目前,至少在 Go 语言中,Cloud Run 快速入门缺少此功能。

假设这是您的问题,请将以下内容添加到 Dockerfile 的最后阶段:

RUN apk add --no-cache ca-certificates
Run Code Online (Sandbox Code Playgroud)