S3 exceptions are not correctly escalated and crash the app on clear cache or navigating to the admin/config

Created on 5 June 2021, about 3 years ago
Updated 15 January 2024, 6 months ago

Problem/Motivation

Let say some S3 bucket are shared across different website environment (QA / STAGE / PROD) or different Drupal Web sites, and these Bucket may contain files with different permission (Some web site instance doesn't have access to same buckets / files), when clear the cache via CLI drush command an exception is flagged, and the cache is not cleared, also the ../admin/config as well as some other admin pages may not be accessible with error : (The website encountered an unexpected error. Please try again later.)
In the Recent log messages we can see :

Aws\Exception\CredentialsException: Error retrieving credentials from the instance profile metadata service. (cURL error 28: Connection timed out after 1001 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)) in Aws\Credentials\InstanceProfileProvider->handleRetryableException() (line 242 of /var/www/html/drupals3/vendor/aws/aws-sdk-php/src/Credentials/InstanceProfileProvider.php).

It's clear that the Exception is not correctly escalated via the vendor Aws\S3\Exception\S3Exception class
This happen especially on Drupal\flysystem_s3\Flysystem\S3->ensure()

Steps to reproduce

Once installed and credential S3 set :
1 - go to your s3 Storage and make the some folder / files pivate
2 - try to clear cache with drush
3- or navigate to the /admin/config
The drush command bring an exception, and in the /admin/config will see an error message

Proposed resolution

Seems that the vendor Aws\S3\Exception\S3Exception is not correctly implemented, Use default PHP Exception instead, also once default exception used we have to exit the execution with an empty array

Will find a patch attached to this feed

πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada SamirMtl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024