Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motoserver multipart upload failure #6281

Closed
vdytyniak-exos opened this issue May 3, 2023 · 1 comment · Fixed by #6287
Closed

Motoserver multipart upload failure #6281

vdytyniak-exos opened this issue May 3, 2023 · 1 comment · Fixed by #6287
Labels

Comments

@vdytyniak-exos
Copy link
Contributor

There is the code I am running to save the file using multipart upload:

import boto3
from boto3.s3.transfer import TransferConfig

s3 = boto3.client('s3')
s3.create_bucket(Bucket='test')
s3.upload_fileobj(
    io.BytesIO(b'123'),
    'test',
    'ns/id=A%20B/9d985da515104b58adcf01acf79f6892-0.raw',
    Config=TransferConfig(multipart_threshold=1),
)

Client error:

botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the CompleteMultipartUpload operation: The specified key does not exist.

Motoserver logs(404 for POST request):

2023-05-03 11:44:47 172.17.0.1 - - [03/May/2023 08:44:47] "PUT /test HTTP/1.1" 200 -
2023-05-03 11:44:47 172.17.0.1 - - [03/May/2023 08:44:47] "POST /test/ns/id%3DA%2520B/9d985da515104b58adcf01acf79f6892-0.raw?uploads HTTP/1.1" 200 -
2023-05-03 11:44:47 172.17.0.1 - - [03/May/2023 08:44:47] "PUT /test/ns/id%3DA%2520B/9d985da515104b58adcf01acf79f6892-0.raw?uploadId=XBHMvHpDsU8xlBSIhfRZetKf0Vum7iUWzdL7eVsgxpsVTZlDchbejBsCQ&partNumber=1 HTTP/1.1" 200 -
2023-05-03 11:44:47 172.17.0.1 - - [03/May/2023 08:44:47] "POST /test/ns/id%3DA%2520B/9d985da515104b58adcf01acf79f6892-0.raw?uploadId=XBHMvHpDsU8xlBSIhfRZetKf0Vum7iUWzdL7eVsgxpsVTZlDchbejBsCQ HTTP/1.1" 404 -

It works fine if you don't use A%20B, but just AB for example:

import boto3
from boto3.s3.transfer import TransferConfig

s3 = boto3.client('s3')
s3.create_bucket(Bucket='test')
s3.upload_fileobj(
    io.BytesIO(b'123'),
    'test',
    'ns/id=AB/9d985da515104b58adcf01acf79f6892-0.raw',
    Config=TransferConfig(multipart_threshold=1),
)

Could you please explain what is wrong with that path?

@vdytyniak-exos
Copy link
Contributor Author

vdytyniak-exos commented May 5, 2023

Created PR: #6287.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants