Files and Folders not displaying when Debug is turned on - Primary Storage S3

Nextcloud version
Debian 10
PHP version: PHP 7.3.19-1~deb10u1

The issue you are facing: Files missing from next cloud when Debug is turned on. Primary storage is S3. When debug is turned on using config.php, file reappear. Even removing the debug config lines makes the files not showing up

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Make debug=false in config.php

The output of your Nextcloud log in Admin > Logging:

Blank Log

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'debug' => true,
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '',
  'datadirectory' => '/var/www/',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'objectstore' =>
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' =>
    array (
      'bucket' => 'fxxx',
      'autocreate' => true,
      'key' => 'xxx',
      'secret' => 'xxx',
      'hostname' => '',
      'use_ssl' => true,
      'region' => 'optional',
      'use_path_style' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => '',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'xx',
  'mail_from_address' => 'xx',
  'mail_smtpname' => '',

The output of your Apache/nginx/system log in /var/log/____:

No related error

Removing the debug line has the same effect (if not defined, the default value false is used).

Yes, But the problem remains, whenever debug is set to false, files and shared group folders are not shown.

Perhaps it helps to play around with the log level so you can see some logs why it is failing. Perhaps some timeouts trigger later with debugging on?