我正在開發GAE/Go應用程序,並嘗試從本地開發服務器連接Google Big Query。GAE上的SSL:CERTIFICATE_VERIFY_FAILED/Go
我的代碼是這樣的。
import (
"cloud.google.com/go/bigquery"
"golang.org/x/net/context"
"google.golang.org/api/option"
gaeLog "google.golang.org/appengine/log"
newappengine "google.golang.org/appengine"
)
func MyFunc(c *gin.Context) {
r := c.Request
ctx := newappengine.NewContext(r)
client, err := bigquery.NewClient(ctx, PROJECT_ID, option.WithServiceAccountFile(SERVICE_ACCOUNT_JSON_FILE_PATH))
if err != nil {
(Error Handling)
}
tableList := client.Dataset(DATASET_ID).Tables(ctx)
for {
v, err := tableList.Next()
if err == iterator.Done {
break
} else if err != nil {
gaeLog.Errorf(ctx, "Failed to get meta-info: %v", err)
return
}
:
}
}
我用goapp.bat serve
命令調用本地開發服務器。 當我發佈請求時,出現錯誤。
api_dev.go:344: ERROR: Failed to get meta-info: Get https://www.googleapis.com/bigquery/v2/projects/myproject/datasets/mydataset/tables?alt=json&pageToken=: oauth2: cannot fetch token: Post https://accounts.google.com/o/oauth2/token: API error 6 (urlfetch: SSL_CERTIFICATE_ERROR): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
我使用了「CERTIFICATE_VERIFY_FAILED」,但我能找到的只是python程序。我的應用程序是GAE/Go程序。
我該如何避免這個錯誤?
嘗試,如果這個解決方案適用於您:http://stackoverflow.com/questions/43221963/google-app-engine-ssl-certificate-error/43233424#43233424 –