【发布时间】:2018-02-14 10:39:32
【问题描述】:
我正在尝试使用 gsutil 根据 google 使用最新版本的 MacOS 的说明在我的 firebase 存储桶上设置 CORS。我不确定是我没有正确安装 gsutil 还是我不明白的其他东西,但是当我运行 gsutil cors set cors.json gs://docavea2.appspot.com 时,我收到以下错误:
Setting CORS on gs://docavea2.appspot.com/...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/jr/google-cloud-sdk/platform/gsutil/gslib/__init__.py", line 119, in <module>
CHECKSUM_FILE, CHECKSUM = _GetFileContents('CHECKSUM')
File "/Users/jr/google-cloud-sdk/platform/gsutil/gslib/__init__.py", line 107, in _GetFileContents
content = pkgutil.get_data('gslib', filename)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 591, in get_data
return loader.get_data(resource_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 255, in get_data
return open(pathname, "rb").read()
IOError: [Errno 2] No such file or directory: '/Users/jr/google-cloud-sdk/platform/gsutil/gslib/CHECKSUM'
我认为我的 cors.json 很好,因为当我在 Windows 上将它与 gsutil 一起使用时,它工作正常并且 CORS 设置正确,但这是内容:
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
我在 stackoverflow 上看到有人说如果他把 [{ 放在同一行,这对他有用,但对我来说没有任何区别。
【问题讨论】:
-
这是一个 pkgutil 问题,而不是您的 CORS 文件的问题。 /Users/jr/google-cloud-sdk/platform/gsutil/gslib/CHECKSUM 是否真的存在于您的系统中?
标签: firebase google-cloud-storage firebase-storage gsutil