4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BigQueryでRedirectMissingLocation: Redirected but response is missing a location: headerのエラーが出た時の対処法

Posted at

pyenvをinstallしているGCEにおいて
bq load xxxx
のコマンドを叩いた時に以下のエラーが出た

RedirectMissingLocation: Redirected but response is missing a location: header

どうやら、特定のpythonのライブラリを使っていると出るらしい

ここらへんにissueがまとまっている

httplib2のversionを0.15.0にすればふせげるらしいので
pip install -U httplib2==0.15.0
したが、状況はかわらず。 

bq コマンドが使っているpythonのlibを変えないといけなかったが、pyenvを使っていたので
gcloudコマンドとbqコマンドのpythonをpyenvのパスに通す

# Use a python you have installed in a special location
export CLOUDSDK_PYTHON=/usr/local/my-custom-python-install/python
export CLOUDSDK_BQ_PYTHON=/usr/local/my-custom-python-install/python

参考
https://cloud.google.com/sdk/gcloud/reference/topic/startup?hl=ja

その上で、pyenvのpipのlibを見るように下記の設定を追加

export CLOUDSDK_PYTHON_SITEPACKAGES=1

これで bq load コマンドが動くようになった

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?