Mounting S3 bucket w/o keys cause Error logs about not using keys

Support intro

Log repeating over and over Undefined array key “key” at /var/www/html/apps/files_external/lib/Lib/Storage/AmazonS3.php#51

Nextcloud version: 30.0
Operating system and version: RHEL 8 x64
Apache or nginx version : nginx:latest
PHP version: 8.2.23

The issue you are facing:
Using the external storage app to mount AWS S3 buckets but I am not using access keys. Logs are saying this is an error due to undefined array where the access keys would normally go. Needs to be suppressed or allow for non access keys mounts w/o all the error logs/noise.

Is this the first time you’ve seen this error? Y

Steps to replicate it:

  1. Enable external storage
  2. Mount S3 bucket w/o access keys
  3. Watch logging

The output of your Nextcloud log in Admin > Logging:

Error	PHP	
Undefined array key "key" at /var/www/html/apps/files_external/lib/Lib/Storage/AmazonS3.php#51

I have no other errors on the system, in fact it is running great. I think the system expects AWS access keys and because they are missing, it is throwing a fit in the logs. The S3 mounts work just fine.

Here is a snippet of the AmazonS3.php file

        public function __construct($parameters) {
                parent::__construct($parameters);
                $this->parseParams($parameters);
                **$this->id = 'amazon::external::' . md5($this->params['hostname'] . ':' . $this->params['bucket'] . ':' . $this->params['key']);**
                $this->objectCache = new CappedMemoryCache();
                $this->directoryCache = new CappedMemoryCache();
                $this->filesCache = new CappedMemoryCache();
                $this->mimeDetector = Server::get(IMimeTypeDetector::class);
                /** @var ICacheFactory $cacheFactory */
                $cacheFactory = Server::get(ICacheFactory::class);
                $this->memCache = $cacheFactory->createLocal('s3-external');
                $this->logger = Server::get(LoggerInterface::class);
        }

The end of line 51 where is says $this->params[‘key’]); is my guess to what is causing the Error log to repeat over and over.


Screenshot of logging page with error messages

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.