jcaddel / maven-s3-wagon

Multi-threaded wagon to connect Maven with Amazon S3
123 stars 50 forks source link

AWS Error Code: InvalidRequest #25

Open mox601 opened 8 years ago

mox601 commented 8 years ago

Just can't make this work.

I use this command:

mvn deploy -Daws.accessKeyId=<A_KEY> -Daws.secretKey=<A_SECRET_KEY> -X

and get back this:

Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: Status Code: 400, AWS Service: Amazon S3, AWS Request ID: <...>, AWS Error Code: InvalidRequest, AWS Error Message: The authorization mechanism you have provided is not suppored. Please use AWS4-HMAC-SHA256., S3 Extended Request ID: <...>

this is a log of the headers received:

[DEBUG] >> "GET /?max-keys=0 HTTP/1.1[\r][\n]"
[DEBUG] >> "Host: <BUCKET_NAME>.s3.amazonaws.com[\r][\n]"
[DEBUG] >> "Authorization: AWS <KEY>[\n]"
[DEBUG] >> "User-Agent: aws-sdk-java/1.6.4 Mac_OS_X/10.8.5 Java_HotSpot(TM)_64-Bit_Server_VM/25.25-b02[\r][\n]"
[DEBUG] >> "Date: Thu, 18 Feb 2016 12:15:40 GMT[\r][\n]"
[DEBUG] >> "Content-Type: application/x-www-form-urlencoded; charset=utf-8[\r][\n]"
[DEBUG] >> "Connection: Keep-Alive[\r][\n]"
[DEBUG] >> "[\r][\n]"
[DEBUG] >> GET /?max-keys=0 HTTP/1.1
[DEBUG] >> Host: <BUCKET_NAME>.s3.amazonaws.com
[DEBUG] >> Authorization: AWS <KEY>
[DEBUG] >> User-Agent: aws-sdk-java/1.6.4 Mac_OS_X/10.8.5 Java_HotSpot(TM)_64-Bit_Server_VM/25.25-b02
[DEBUG] >> Date: Thu, 18 Feb 2016 12:15:40 GMT
[DEBUG] >> Content-Type: application/x-www-form-urlencoded; charset=utf-8
[DEBUG] >> Connection: Keep-Alive
[DEBUG] << "HTTP/1.1 400 Bad Request[\r][\n]"
[DEBUG] << "x-amz-bucket-region: eu-central-1[\r][\n]"
[DEBUG] << "x-amz-request-id: 097DD717AF3D5842[\r][\n]"
[DEBUG] << "x-amz-id-2: IJS/lkQ2UoDf0TIp4sQzXqgD0PfiRNUsVrZTty00EzOIvIBMTuTFZpmuXNlj8964DDfurfyBDN8=[\r][\n]"
[DEBUG] << "x-amz-region: eu-central-1[\r][\n]"
[DEBUG] << "Content-Type: application/xml[\r][\n]"
[DEBUG] << "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] << "Date: Thu, 18 Feb 2016 12:15:41 GMT[\r][\n]"
[DEBUG] << "Connection: close[\r][\n]"
[DEBUG] << "Server: AmazonS3[\r][\n]"
[DEBUG] << "[\r][\n]"
[DEBUG] Receiving response: HTTP/1.1 400 Bad Request
[DEBUG] << HTTP/1.1 400 Bad Request
[DEBUG] << x-amz-bucket-region: eu-central-1
[DEBUG] << x-amz-request-id: 097DD717AF3D5842
[DEBUG] << x-amz-id-2: IJS/lkQ2UoDf0TIp4sQzXqgD0PfiRNUsVrZTty00EzOIvIBMTuTFZpmuXNlj8964DDfurfyBDN8=
[DEBUG] << x-amz-region: eu-central-1
[DEBUG] << Content-Type: application/xml
[DEBUG] << Transfer-Encoding: chunked
[DEBUG] << Date: Thu, 18 Feb 2016 12:15:41 GMT
[DEBUG] << Connection: close
[DEBUG] << Server: AmazonS3
[DEBUG] << "144[\r][\n]"
[DEBUG] << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
[DEBUG] << "<Error><Code>InvalidRequest</Code><Message>The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.</Message><RequestId>097DD717AF3D5842</RequestId><HostId>IJS/lkQ2UoDf0TIp4sQzXqgD0PfiRNUsVrZTty00EzOIvIBMTuTFZpmuXNlj8964DDfurfyBDN8=</HostId></Error>"
seletz commented 8 years ago

Just ran into this as well.

http://stackoverflow.com/questions/26533245/the-authorization-mechanism-you-have-provided-is-not-supported-please-use-aws4/26538266

It seems that this plugin doesn't support the new V4 auth method.

Not all S3 locations apparently support the older auth format -- e.g. Frankfurt doesn't.

vatbub commented 7 years ago

Heyho, I just ran into it as well and switched from Frankfurt to Oregon and it works now.

rafalwrzeszcz commented 6 years ago

As it's not always possible to simply switch region, you may be interested in different plugin for that. I think the only one that supports V4 auth is:

            <extension>
                <groupId>org.zalando.org.springframework.build</groupId>
                <artifactId>aws-maven</artifactId>
                <version>5.0.0.RELEASE-zal-2</version>
            </extension>

(it's a Spring's wagon fork that was updated by Zalando with newer AWS SDK, that's all)

The problem is that this wagon doesn't support filePermissions so is not suitable for cross-account access.