Comments (3)
Hi @Paril, thanks for reporting this. I was able to reproduce the issue by following your example. I am working on root causing it. I will provide updates as soon as possible.
Thanks!
from aws-sdk-php.
Hi @Paril, we are still working on getting this fixed; however, in the meantime, a workaround would be to provide a custom http handler in the client as following:
$s3 = new S3Client([
'region' => getenv('TEST_REGION'),
'version' => 'latest',
'http_handler' => function (RequestInterface $request, $options) {
return \Aws\default_http_handler()($request, $options);
}
]);
I will provide more updates here, once we get this fixed.
Thanks!
from aws-sdk-php.
Here's a SSCEE of the problem. The only requirements is that:
a) all files and keynames referenced exist (except in the case of put dest files, obviously)
b) the PHP script does not have write access to the destination file for the get (ie, getObject must throw an exception)
private function testBroken()
{
$bucketName = '....'; // put in your bucket here
$s3 = new Aws\S3\S3Client([
'region' => 'us-east-1',
'version' => 'latest'
]);
$get_key_name = 'files/sigs/test-put.png'; // must exist on S3
$get_save_to = 'files/sigs/test-saveas.png'; // must either not exist, or not have permission to access
try
{
// test get; this should throw
$params = [
'Bucket' => $bucketName,
'Key' => $get_key_name
];
$params['SaveAs'] = $get_save_to;
$file = $s3->getObject($params);
}
catch (Exception)
{
printf('got error, as expected\n');
}
try
{
// test put_many, this should not throw
$put_files = [
[ 'path' => 'files/sigs/test-0.png', 'key' => 'files/sigs/test-0.png' ], // source files must exist!
[ 'path' => 'files/sigs/test-1.png', 'key' => 'files/sigs/test-1.png' ] ];
$put_promises = [];
foreach ($put_files as $file)
{
$put_promises[] = $s3->putObjectAsync([
'Bucket' => $bucketName,
'Key' => $file['key'],
'ACL' => 'public-read',
'SourceFile' => $file['path']
]);
}
\GuzzleHttp\Promise\Utils::unwrap($put_promises);
printf('put success\n');
}
catch (Exception)
{
printf('got error, unexpected!!\n');
}
}
Note that the following will happen:
got error, as expected
will be logged. this is expected, obviously, as the file should not have write permissions. This is not the problem, and is expected!got error, unexpected!!
will be logged next. This is the bug. The exception, if you introspect it, will be the exception from the firstget
failure and not related to theput
at all.
If you remove the getObject
call entirely, the put
s will succeed.
from aws-sdk-php.
Related Issues (20)
- Pull request #2776 breaks local development when using amazon/amazon-ecs-local-container-endpoints container HOT 6
- Incorrect complaint wrt provided types HOT 8
- SQS messages without attributes cannot be received HOT 6
- Operation not found: GetHLSStreamingSessionURL HOT 9
- Add custom headers support to SES sendBulkTemplatedEmail HOT 6
- AwsS3S3Client::AwsS3{closure}(): Argument #1 ($e) must be of type AwsExceptionAwsException HOT 4
- no longer possible to use ElasticMQ since 3.286.2 HOT 3
- Unable to override IMDSv2 service URL HOT 3
- Use of SSO roles for PHP CLI HOT 1
- Incorrect argument type HOT 5
- fprintf(): supplied resource is not a valid stream resource HOT 4
- SignatureV4 mismatch on some requests HOT 7
- Deprecated: Using ${var} in strings is deprecated HOT 3
- Support 'OriginationNumber' when sending SMS. HOT 1
- IRSA for Kubernetes not working HOT 3
- Argument 4 passed to Aws\Exception\AwsException::__construct() must be an instance of Exception or null HOT 3
- verifyDomainDkim method of SES Client returns validation error HOT 4
- Yum package
- InstanceProfile credentials provider causing open_basedir restriction error since 3.297.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-php.