0
0

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 1 year has passed since last update.

firebase storageにpython から画像をアップロードしようとした時のエラー備忘録

Posted at

概要

Python のバックエンド(FastAPI)を通して
Firebase Storage に画像ファイルをアップロードしようとした時のこと。
以下のようなエラーになっていた。

エラー

google.api_core.exceptions.NotFound: 404 POST https://storage.googleapis.com/upload/storage/v1/b/gs://xxxxxx.appspot.com/o?uploadType=multipart: Not Found: ('Request failed with status code', 404, 'Expected one of', <HTTPStatus.OK: 200>)

解決策

ここのFourth Stepにあるように、
gs:// は省略しておかなければならない。

cred = credentials.Certificate("firebase.json")
firebase_admin.initialize_app(cred, {"storageBucket": "gs://xxx.appspot.com"})

ではなく、

cred = credentials.Certificate("firebase.json")
firebase_admin.initialize_app(cred, {"storageBucket": "xxx.appspot.com"})

だと通る。
備忘録として残しておく。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?