InvalidCredsError with upload_object_via_stream() on Aurora Objects

Offen
#1,657 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
cloud

Rechercherichtung

Beginne in libcloud/storage/drivers/s3.py bei upload_object_via_stream(), _put_object_multipart() und _initiate_multipart() und vergleiche diesen Pfad mit dem funktionierenden Pfad von upload_object(). Reproduziere das Aurora Objects-Beispiel und verfolge die Multipart-Initiierungsanfrage; als abgeschlossen gilt die Aufgabe, wenn Streaming-Uploads ohne SignatureDoesNotMatch oder InvalidCredsError erfolgreich sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
2.1k
Forks
935
Ø Merge
5 T. 3 Std.
Gemergte PRs (30 T.)
15

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/libcloud

Alle Issues in apache/libcloud

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.