S3 as primary storage causes FileNotFound errors

Numbers

Nextcloud version: 18.0.4
Operating system and version: Ubuntu 16.04.6 LTS
Apache or nginx: nginx/1.17.3
PHP version: 7.2.31

The issue you are facing:

I have made a fresh manual nextcloud install from the installation wizard, and everything seems to be working fine. I can view files and look at settings and so on. I now want to try and add Wasabi S3 storage as my primary storage. I tried to do that by just adding the configuration block on config.php. My config file is then:

<?php
$CONFIG = array (
  'instanceid' => '1111oneone',
  'passwordsalt' => 'just_right',
  'secret' => 'shuush',
  'trusted_domains' =>
  array (
    0 => 'website.com',
  ),
  'datadirectory' => '/data/dir',
  'dbtype' => 'mysql',
  'version' => '18.0.4.2',
  'overwrite.cli.url' => 'https://website.com',
  'dbname' => 'all_your_base_are_belong_to_us',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_gangsta',
  'dbpassword' => 'changeme',
  'installed' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'objectstore' => array(
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket' => 'o_fish',
                'autocreate' => true,
                'key'    => 'to_the_city',
                'secret' => 'i_feel_older_and_older_with_each_passing_day',
                'hostname' => 's3.eu-central-1.wasabisys.com',
                'port' => 443,
                'use_ssl' => true,
                'region' => 'eu-central-1',
                'use_path_style'=>true
        ),
  ),
);

However, that causes internal errors. My nextcloud log registers these 3 errors with every page refresh.

{
    "reqId": "r5Bj1yuRd8pR4kKYDQJg",
    "level": 3,
    "time": "2020-06-02T16:35:28+00:00",
    "remoteAddr": "147.12.212.5",
    "user": "admin",
    "app": "index",
    "method": "GET",
    "url": "/apps/files/",
    "message": {
        "Exception": "OCP\\Files\\NotFoundException",
        "Message": "",
        "Code": 0,
        "Trace": [{
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 139,
                "function": "getStorageInfo",
                "class": "OC_Helper",
                "type": "::",
                "args": ["/", false]
            }, {
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 187,
                "function": "getStorageInfo",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": []
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 170,
                "function": "index",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": ["", "", null, false]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 99,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
                "line": 125,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",
                "line": 47,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::",
                "args": ["OCA\\Files\\Controller\\ViewController", "index", {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "function": "__invoke",
                "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
                "type": "->",
                "args": [{
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/private/Route/Router.php",
                "line": 299,
                "function": "call_user_func",
                "args": [{
                        "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/base.php",
                "line": 1008,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->",
                "args": ["/apps/files/"]
            }, {
                "file": "/var/www/nextcloud/index.php",
                "line": 38,
                "function": "handleRequest",
                "class": "OC",
                "type": "::",
                "args": []
            }
        ],
        "File": "/var/www/nextcloud/lib/private/legacy/helper.php",
        "Line": 490,
        "CustomMessage": "--"
    },
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
    "version": "18.0.4.2"
}
{
    "reqId": "IL2U910cJuZYtMpblual",
    "level": 3,
    "time": "2020-06-02T16:35:28+00:00",
    "remoteAddr": "147.12.212.5",
    "user": "admin",
    "app": "index",
    "method": "GET",
    "url": "/apps/files/",
    "message": {
        "Exception": "OCP\\Files\\NotFoundException",
        "Message": "",
        "Code": 0,
        "Trace": [{
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 139,
                "function": "getStorageInfo",
                "class": "OC_Helper",
                "type": "::",
                "args": ["/", false]
            }, {
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 187,
                "function": "getStorageInfo",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": []
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 170,
                "function": "index",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": ["", "", null, false]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 99,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
                "line": 125,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",
                "line": 47,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::",
                "args": ["OCA\\Files\\Controller\\ViewController", "index", {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "function": "__invoke",
                "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
                "type": "->",
                "args": [{
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/private/Route/Router.php",
                "line": 299,
                "function": "call_user_func",
                "args": [{
                        "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/base.php",
                "line": 1008,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->",
                "args": ["/apps/files/"]
            }, {
                "file": "/var/www/nextcloud/index.php",
                "line": 38,
                "function": "handleRequest",
                "class": "OC",
                "type": "::",
                "args": []
            }
        ],
        "File": "/var/www/nextcloud/lib/private/legacy/helper.php",
        "Line": 490,
        "CustomMessage": "--"
    },
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
    "version": "18.0.4.2"
}
{
    "reqId": "Ge7IFpLNtqFySWOoXJCX",
    "level": 3,
    "time": "2020-06-02T16:35:29+00:00",
    "remoteAddr": "147.12.212.5",
    "user": "admin",
    "app": "index",
    "method": "GET",
    "url": "/apps/files/",
    "message": {
        "Exception": "OCP\\Files\\NotFoundException",
        "Message": "",
        "Code": 0,
        "Trace": [{
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 139,
                "function": "getStorageInfo",
                "class": "OC_Helper",
                "type": "::",
                "args": ["/", false]
            }, {
                "file": "/var/www/nextcloud/apps/files/lib/Controller/ViewController.php",
                "line": 187,
                "function": "getStorageInfo",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": []
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 170,
                "function": "index",
                "class": "OCA\\Files\\Controller\\ViewController",
                "type": "->",
                "args": ["", "", null, false]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 99,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
                "line": 125,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [{
                        "__class__": "OCA\\Files\\Controller\\ViewController"
                    }, "index"]
            }, {
                "file": "/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",
                "line": 47,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::",
                "args": ["OCA\\Files\\Controller\\ViewController", "index", {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "function": "__invoke",
                "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
                "type": "->",
                "args": [{
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/private/Route/Router.php",
                "line": 299,
                "function": "call_user_func",
                "args": [{
                        "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
                    }, {
                        "_route": "files.view.index"
                    }
                ]
            }, {
                "file": "/var/www/nextcloud/lib/base.php",
                "line": 1008,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->",
                "args": ["/apps/files/"]
            }, {
                "file": "/var/www/nextcloud/index.php",
                "line": 38,
                "function": "handleRequest",
                "class": "OC",
                "type": "::",
                "args": []
            }
        ],
        "File": "/var/www/nextcloud/lib/private/legacy/helper.php",
        "Line": 490,
        "CustomMessage": "--"
    },
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
    "version": "18.0.4.2"
}

And nothing gets registered on my nginx log. Interestingly, some files do get created on the wasabi bucket. I feel I am missing some step here. Does anyone know what I could be missing?

This is not clear in the documentation at all, but the problem was trying to do this on a live website (i.e. after running the installation wizard). This article shows that you have to put the objectstore entry on a storage.config.php file on the config folder BEFORE running the installation wizard. Then everything is OK.

Hope this helps others. Ideally the documentation should be changed to reflect that.