Skip to content

AwsS3S3Client::AwsS3{closure}(): Argument #1 ($e) must be of type AwsExceptionAwsException #2845

Closed
@RaviJayagopal

Description

@RaviJayagopal

Describe the bug

The following code is resulting in the error:
AwsS3S3Client::AwsS3{closure}(): Argument #1 ($e) must be of type AwsExceptionAwsException, TypeError given, called in /home/customer/www///vendor/guzzlehttp/promises/src/Promise.php on line 203

$s3Client = new Aws\S3\S3MultiRegionClient([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => $accessKey,
'secret' => $secretKey,
],
]);

$region = $s3Client->determineBucketRegion($bucketname);

The script crashes at the last line above at the determineBucketRegion call, and $region is null after the statement.

This works fine in PHP 7.x (tested up to v7.4.33), but crashes in all versions of PHP 8.x (tested up to v8.2.12).

AWS SDK:
"aws/aws-sdk-php": "3.x",
"guzzlehttp/guzzle": "7.8.",
"guzzlehttp/promises": "2.0.
",

TIA for your help.

Expected Behavior

$region should have a valid region value, and the code should not crash.

Current Behavior

Code crashes at:

$region = $s3Client->determineBucketRegion($bucketname);

Reproduction Steps

$s3Client = new Aws\S3\S3MultiRegionClient([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => [
'key' => $accessKey,
'secret' => $secretKey,
],
]);

$region = $s3Client->determineBucketRegion($bucketname);

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.x

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.x

Metadata

Metadata

Labels

closing-soonThis issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions