Description
Server fails to map AWS CLI request to on aws s3 cp
:
o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 400
o.s.web.servlet.DispatcherServlet : PUT "/backups/README.md", parameters={}
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.adobe.testing.s3mock.ObjectController#putObject(String, ObjectKey, List, String, String, StorageClass, HttpHeaders, InputStream)
o.s.w.s.m.m.a.HttpEntityMethodProcessor : Found 'Content-Type:application/xml' in response
o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [ErrorResponse[code=UnexpectedContent, message=This request contains unsupported content., resource=n (truncated)...]
The request is logged as:
Making request for OperationModel(name=PutObject) with params: {'url_path': '/README.md', 'query_string': {}, 'method': 'PUT', 'headers': {'Content-Type': 'text/markdown', 'User-Agent': 'aws-cli/2.15.37 Python/3.11.8 Linux/6.1.0-31-amd64 exe/x86_64.debian.12 prompt/off command/s3.cp', 'Content-MD5': 'rLtqOfcZH0Ny51fAf5RNrg==', 'Expect': '100-continue'}, 'body': <s3transfer.utils.ReadFileChunk object at 0x7f0a3bd34f90>, 'auth_path': '/backups/README.md', 'url': 'http://localhost:9098/backups/README.md', 'context': {'client_region': 'eu-west-3', 'client_config': <botocore.config.Config object at 0x7f0a3c1ca410>, 'has_streaming_input': True, 'auth_type': 'v4', 'signing': {'region': 'eu-west-3', 'signing_name': 's3', 'disableDoubleEncoding': True}, 'endpoint_properties': {'authSchemes': [{'disableDoubleEncoding': True, 'name': 'sigv4', 'signingName': 's3', 'signingRegion': 'eu-west-3'}]}, 's3_redirect': {'redirected': False, 'bucket': 'backups', 'params': {'Bucket': 'backups', 'Key': 'README.md', 'Body': <s3transfer.utils.ReadFileChunk object at 0x7f0a3bd34f90>, 'ContentType': 'text/markdown'}}, 'S3Express': {'bucket_name': 'backups'}}}
Git bisect points at commit "Use Tomcat instead of Jetty": a327414
Works with Docker Hub image 3.12.0
and fails with Docker hub image 4.0.0
. Replicated locally by building commits with ./mvnw clean package -pl server,docker -am -DskipTests -Dcheckstyle.skip
and starting server with docker run --rm -p 9098:9090 -e initialBuckets=backups -e debug=true adobe/s3mock:latest
(not changing port mapping and using -p 9090:9090
yields to the same results): server.log.
CLI executed with aws --debug --endpoint-url http://localhost:9098 s3 cp README.md s3://backups/README.md
(from the root of this project, hence project's README being uploaded): cli.log
Fails with AWS CLI version 2.15.37
installed from Debian packages and also with version 2.22.10
running in an Alpine Docker container (FROM alpine:3.21.3
+ apk add aws-cli
).
aws --version
aws-cli/2.15.37 Python/3.11.8 Linux/6.1.0-31-amd64 exe/x86_64.debian.12 prompt/off
Other endpoints work fine:
aws --endpoint http://localhost:9098 s3api list-buckets
{
"Buckets": [
{
"Name": "backups",
"CreationDate": "2025-04-09T09:13:16.392000+00:00"
}
],
"Owner": {
"DisplayName": "s3-mock-file-store",
"ID": "79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"
}
}
Writing files works from curl:
curl -v --request PUT --upload-file ./README.md http://localhost:9098/backups/README.md
> PUT /backups/README.md HTTP/1.1
> Host: localhost:9098
> User-Agent: curl/7.88.1
> Accept: */*
> Content-Length: 42443
> Expect: 100-continue
>
< HTTP/1.1 100
* We are completely uploaded and fine
< HTTP/1.1 200
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< Last-Modified: Wed, 09 Apr 2025 09:13:22 GMT
< ETag: "acbb6a39f7191f4372e757c07f944dae"
< Content-Length: 0
< Date: Wed, 09 Apr 2025 09:13:22 GMT