InvalidCredsError with upload_object_via_stream() on Aurora Objects

未关闭
#1,657 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
cloud

调研方向

从 libcloud/storage/drivers/s3.py 中的 upload_object_via_stream()、_put_object_multipart() 和 _initiate_multipart() 开始,将这条路径与正常工作的 upload_object() 路径进行比较。复现 Aurora Objects 示例并跟踪 multipart 初始化请求;当流式上传能够成功完成且不出现 SignatureDoesNotMatch 或 InvalidCredsError 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Summary

When trying to upload a file to Aurora Objects through upload_object_via_stream(), I get an InvalidCredsError.

Detailed Information

When I try the following code:

from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

cls = get_driver(Provider.AURORAOBJECTS)
driver = cls('api-key', 'secret-key')

container = driver.get_container('container')

container.upload_object_via_stream(iter([b'test']), 'test.txt')

It results in the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/storage/base.py", line 216, in upload_object_via_stream
    return self.driver.upload_object_via_stream(
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/storage/drivers/s3.py", line 747, in upload_object_via_stream
    return self._put_object_multipart(container=container,
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/storage/drivers/s3.py", line 988, in _put_object_multipart
    upload_id = self._initiate_multipart(container, object_name,
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/storage/drivers/s3.py", line 572, in _initiate_multipart
    response = self.connection.request(request_path, method='POST',
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/common/base.py", line 667, in request
    response = responseCls(**kwargs)
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/common/base.py", line 167, in __init__
    message=self.parse_error(),
  File "/home/wout/project/.venv/lib/python3.9/site-packages/libcloud/storage/drivers/s3.py", line 138, in parse_error
    raise InvalidCredsError(self.body)
libcloud.common.types.InvalidCredsError: '<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx00000000000004e0ebfe5-00620a68e9-1d4a885a-ams02</RequestId><HostId>1d4a885a-ams02-eu</HostId></Error>'

However upload_object() is working fine as follows:

from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

cls = get_driver(Provider.AURORAOBJECTS)
driver = cls('api-key', 'secret-key')

container = driver.get_container('container')

container.upload_object('test.txt', 'test.txt')

I am using Python 3.9.8-1 on Debian unstable with Libcloud 3.4.1.

主要语言
Python
星标
2.1k
派生
935
平均合并
5 天 3 小时
30 天内合并 PR
15

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/libcloud 的其他 Issue

查看 apache/libcloud 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。