aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
5.99k stars 1.2k forks source link

Version 3.311.0 always triggers “Aws\\Command::setAuthSchemes is deprecated” #2937

Closed adlcadn closed 3 weeks ago

adlcadn commented 3 weeks ago

Describe the bug

Version 3.311.0 systematically triggers “Aws\Command::setAuthSchemes is deprecated” when calling S3Client to store or access objects in a bucket.

Expected Behavior

No error.

Current Behavior

ERROR at 2024-06-05 20:36:20 in ErrorException : Aws\Command::setAuthSchemes is deprecated. Auth schemes resolved using the service auth trait or via endpoint resolution are now set in the command @context property.` in /var/app/current/vendor/aws/aws-sdk-php/src/Command.php(78)

1 : /var/app/current/vendor/aws/aws-sdk-php/src/Command.php (78) : trigger_error

2 : /var/app/current/vendor/aws/aws-sdk-php/src/EndpointV2/EndpointV2Middleware.php (234) : setAuthSchemes : Aws\Command : ->

3 : /var/app/current/vendor/aws/aws-sdk-php/src/EndpointV2/EndpointV2Middleware.php (95) : applyAuthScheme : Aws\EndpointV2\EndpointV2Middleware : ->

4 : /var/app/current/vendor/aws/aws-sdk-php/src/Auth/AuthSelectionMiddleware.php (97) : __invoke : Aws\EndpointV2\EndpointV2Middleware : ->

5 : /var/app/current/vendor/aws/aws-sdk-php/src/InputValidationMiddleware.php (73) : __invoke : Aws\Auth\AuthSelectionMiddleware : ->

6 : /var/app/current/vendor/aws/aws-sdk-php/src/Middleware.php (90) : __invoke : Aws\InputValidationMiddleware : ->

7 : /var/app/current/vendor/aws/aws-sdk-php/src/S3/S3Client.php (627) : Aws\{closure} : Aws\Middleware : ::

8 : /var/app/current/vendor/aws/aws-sdk-php/src/S3/S3Client.php (650) : Aws\S3\{closure} : Aws\S3\S3Client : ::

9 : /var/app/current/vendor/aws/aws-sdk-php/src/S3/S3Client.php (584) : Aws\S3\{closure} : Aws\S3\S3Client : ::

10 : /var/app/current/vendor/aws/aws-sdk-php/src/S3/S3Client.php (603) : Aws\S3\{closure} : Aws\S3\S3Client : ::

11 : /var/app/current/vendor/aws/aws-sdk-php/src/Middleware.php (58) : Aws\S3\{closure} : Aws\S3\S3Client : ::

12 : /var/app/current/vendor/aws/aws-sdk-php/src/S3/SSECMiddleware.php (59) : Aws\{closure} : Aws\Middleware : ::

13 : /var/app/current/vendor/aws/aws-sdk-php/src/IdempotencyTokenMiddleware.php (77) : __invoke : Aws\S3\SSECMiddleware : ->

14 : /var/app/current/vendor/aws/aws-sdk-php/src/AwsClientTrait.php (64) : __invoke : Aws\IdempotencyTokenMiddleware : ->

15 : /var/app/current/vendor/aws/aws-sdk-php/src/AwsClientTrait.php (58) : executeAsync : Aws\AwsClient : ->

16 : /var/app/current/vendor/aws/aws-sdk-php/src/AwsClientTrait.php (86) : execute : Aws\AwsClient : ->

17 : /var/app/current/src/db/S3Manager.php (132) : __call : Aws\AwsClient : ->

18 : /var/app/current/src/objects/ExcelWriter.php (54) : saveFile : Bepay\Db\S3Manager : ->

19 : /var/app/current/src/docs/docCompta.php (445) : saveS3 : Bepay\Objects\ExcelWriter

...

Reproduction Steps

Exemple of call :

$result = $this->s3->putObject([
                'Bucket' => $theBucket,
                'ServerSideEncryption' => 'aws:kms',
                'SSEKMSKeyId' => $this->kmskey,
                'Key' => $key,
                'SourceFile' => $file
            ]);

or $this->s3->doesObjectExist($bucket, $key)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.311.0

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

PHP 8.2 running on 64bit Amazon Linux 2023/4.1.3

fernandoval commented 3 weeks ago

Same problem here.

This broke my app.

I'm downgrading to 3.310.0 until it's resolved.

Patfreeze commented 3 weeks ago

Same problem here, deprecated must not brake code, the problem is that it use "trigger_error".

stobrien89 commented 3 weeks ago

Sorry to hear about the issues @fernandoval and @Patfreeze. Working on a fix for this right now. Out of curiosity, are either of you using custom error handlers?

stobrien89 commented 3 weeks ago

This should be fixed as of today's release. Please let us know if you have any issues after updating.

Patfreeze commented 3 weeks ago

@stobrien89 Yes we use a custom error handlers. After the fix of today, it work. Thanks for the quick fix.

fernandoval commented 3 weeks ago

@stobrien89 Yes, we use a custom error handler. The app can be configured to ignore E_USER_DEPRECATED exceptions, but this goes against our internal zero-error policy.

Problem resolved. Thank you for your quick response.

stobrien89 commented 3 weeks ago

@fernandoval and @Patfreeze,

Glad the issue is resolved. We kept a call to a deprecated method and suppressed it, but in hindsight I think we would have been better off removing it when we first released those changes. Thanks for your patience— closing this now.

github-actions[bot] commented 3 weeks ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.