-
Notifications
You must be signed in to change notification settings - Fork 50
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
aws-sdk-php tests fail for server/gateway #216
Comments
Findings from investigation
<?php
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\Credentials;
use Aws\Exception\AwsException;
use GuzzleHttp\Psr7;
use GuzzleHttp\Client;
$s3Client = new S3Client([
'credentials' => [
'key' => 'accessKey',
'secret' => 'secretKey',
],
'scheme' => 'http',
'use_path_style_endpoint' => true,
'region' => 'us-east-1',
'version' => '2006-03-01'
]);
$bucket = 'mybucket';
$object = 'myobject';
$sha256 = "invalid-sha256";
$cmd = $s3Client->getCommand('PutObject', [
'Bucket' => $bucket,
'Key' => $object,
'ContentSHA256' => $sha256,
]);
$request = $s3Client->createPresignedRequest($cmd, '+20 minutes');
$presignedUrl = (string) $request->getUri();
echo $presignedUrl;
$client = new Client(['debug' => true]);
$body = "Hello, World";
$res = $client->request('PUT', $presignedUrl, ['body' => $body]);
echo 'statusCode: ' . $res->getStatusCode();
?> Resolution
|
We should change the test to incorporate this perhaps package main() {
//creds := credentials.NewStaticCredentials("USWUXHGYZQYFYFFIT3RE", "MOJRH0mkL1IPauahWITSVvyDrQbEEIwljvmxdq03", "")
creds := credentials.NewStaticCredentials(os.Getenv("ACCESS_KEY"), os.Getenv("SECRET_KEY"), "")
newSession := session.New()
s3Config := &aws.Config{
Credentials: creds,
//Endpoint: aws.String("http://localhost:9000"),
Endpoint: aws.String("https://s3.amazonaws.com"),
Region: aws.String("us-east-1"),
//DisableSSL: aws.Bool(true),
//S3ForcePathStyle: aws.Bool(true),
}
// Create an S3 service object in the default region.
s3Client := s3.New(newSession, s3Config)
req, _ := s3Client.PutObjectRequest(&s3.PutObjectInput{
Bucket: aws.String("vadmeste"),
Key: aws.String("object"),
ContentType: aws.String("application/octet-stream"),
})
req.HTTPRequest.Header.Set("Content-Md5", "82bb413746aee42f89dea2b59614f9ef")
url, err := req.Presign(24 * time.Hour)
if err != nil {
panic(err)
}
rreq, err := http.NewRequest("PUT", url, bytes.NewReader([]byte("")))
rreq.Header.Add("Content-Type", "application/octet-stream")
rreq.Header.Set("Content-Md5", "82bb413746aee42f89dea2b59614f9ef")
log.Println("REQUEST PUT ", url)
for k, v := range rreq.Header {
log.Printf("%v: %v", k, v)
}
resp, err := http.DefaultClient.Do(rreq)
if err != nil {
panic(err)
}
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
panic(err)
}
log.Println("AMZ RESPONSE")
for k, v := range resp.Header {
log.Printf("%v: %v", k, v)
}
log.Printf("\n%v", string(body))
}
|
Resolution (Updated)
|
This PR #222 is needed as well |
Mint test on latest rc failed. Reproducible with both Server and Gateway modes
Mint logs:
Server logs:
The text was updated successfully, but these errors were encountered: