0
votes

I have a BigQuery job running periodically. It was running fine so far. Now I am getting the following error. And when I directly tried executing the bq commands in the terminal it does not result in the same error response consistently. Sometimes it works fine.

The bash command used is:

bq query --project_id=$BQ_PROJECT_ID --nouse_legacy_sql --format=json --quiet $MAX_TIME_QUERY

And it raises the following error:

BigQuery error in query operation: Cannot contact server. Please try again. Traceback: Traceback (most recent call last): File "/google-cloud-sdk/platform/bq/bigquery_client.py", line 681, in BuildApiClient _, discovery_document = http.request(discovery_url) File "/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/transport.py", line 160, in new_request credentials._refresh(orig_request_method) File "/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/client.py", line 762, in _refresh self._do_refresh_request(http) File "/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/client.py", line 781, in _do_refresh_request body=body, headers=headers) File "/google-cloud-sdk/platform/bq/third_party/oauth2client_4_0/transport.py", line 283, in request connection_type=connection_type) File "/google-cloud-sdk/platform/bq/third_party/httplib2/init.py", line 1626, in request (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey) File "/google-cloud-sdk/platform/bq/third_party/httplib2/init.py", line 1368, in _request (response, content) = self._conn_request(conn, request_uri, method, body, headers) File "/google-cloud-sdk/platform/bq/third_party/httplib2/init.py", line 1288, in _conn_request conn.connect() File "/google-cloud-sdk/platform/bq/third_party/httplib2/init.py", line 1082, in connect raise SSLHandshakeError(e) SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

I am using this within docker container (google/cloud-sdk:206.0.0-alpine). Also the same container when run on my mac laptop it works fine. When I check the same on a linux server it fails.

1
SSL errors normally indicate that some kind of proxy is interfering. - Elliott Brossard
@ElliottBrossard Why is it not consistently resulting in error? It does work sometime if I run multiple times. Also why does commands within docker container work on my mac but not on linux server. - prem kumar
I was able to resolve this "certificate verify failed" issue after uninstalling the httplib2 package - Christopher
@Christopher but it is not consistent, the issue I am facing. Also it works on my mac using the google cloud sdk docker container. Any links to the issue you faced. - prem kumar
@premkumar I did not create an SO post for my issue. The issue happened to me whenever I try to run any python script on my Cloud Shell (it got messed up probably). I tried to search for answers everywhere on how to resolve the error "SSL: CERTIFICATE_VERIFY_FAILED" but in the end I did uninstall the package and the issue got resolved. - Christopher

1 Answers

1
votes

Upgrading to google/cloud-sdk:250.0.0-alpine version resolved the problem. I did not figure out the root cause for this problem but upgrading helped to fix it.