Missing or invalid config ownCloud Web

Steps to reproduce

  1. Follow this guide Deploy as an app in ownCloud 10 | ownCloud

Expected behaviour

After installing ownCloud Web, when I click on application switcher called New Design, I should not get the error ‘Missing or invalid config’.

Actual behaviour

I get the error ‘Missing or invalid config’, browser console shows

GET https://my.domain.com/index.php/apps/web/config.json 500

Server configuration

Operating system: Ubuntu 22.04 LTS

Web server: Apache2

Database: MariaDB

PHP version: 7.4

ownCloud version: ownCloud 10.10.0 (stable)

Updated from an older ownCloud or fresh install:

Where did you install ownCloud from: Install ownCloud on Ubuntu 20.04 :: ownCloud Documentation

Signing status (ownCloud 9.0 and above):

No errors have been found.

The content of config/config.php:


{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "2": "coursepage.com",
            "1": "storage.coursepage.com"
        },
        "web.baseUrl": "https:\/\/storage.coursepage.com\/index.php\/apps\/web",
        "web.rewriteLinks": true,
        "server": "https:\/\/storage.coursepage.com",
        "theme": "https:\/\/storage.coursepage.com\/themes\/owncloud\/theme.json",
        "auth": {
            "clientId": "T78skHLLdxEwJzJlyvaryWLy9ayk5g2bmJbn4GeFw5EyHCJPvRaUlMW90xah2YIx",
            "url": "https:\/\/storage.coursepage.com\/index.php\/apps\/oauth2\/api\/v1\/token",
            "authUrl": "https:\/\/storage.coursepage.com\/index.php\/apps\/oauth2\/authorize"
        },
        "apps": [
            "files",
            "preview",
            "draw-io"
        ],
        "applications": [
            {
                "title": {
                    "en": "Classic Design",
                    "de": "Klassisches Design",
                    "fr": "Design classique",
                    "zh_CN": "\u6587\u4ef6"
                },
                "icon": "swap-box",
                "url": "https:\/\/storage.coursepage.com\/index.php\/apps\/files"
            },
            {
                "icon": "settings-4",
                "menu": "user",
                "target": "_self",
                "title": {
                    "de": "Einstellungen",
                    "en": "Settings"
                },
                "url": "https:\/\/storage.coursepage.com\/index.php\/settings\/personal"
            },
            {
                "title": {
                    "en": "Custom Groups",
                    "de": "Benutzerdefinierte Gruppen"
                },
                "icon": "settings-4",
                "url": "https:\/\/storage.coursepage.com\/settings\/personal?sectionid=customgroups"
            }
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbtype": "mysql",
        "version": "10.10.0.3",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "allow_user_to_change_mail_address": "",
        "logtimezone": "UTC",
        "apps_paths": [
            {
                "path": "\/var\/www\/owncloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/owncloud\/apps-external",
                "url": "\/apps-external",
                "writable": true
            }
        ],
        "installed": true,
        "instanceid": "oc9bcwsjao6d",
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "127.0.0.1",
            "port": "6379"
        }
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Chrome

Operating system: Linux

Logs

Web server log

172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/css/web.css?1649687610584 HTTP/1.1" 200 23818 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36" 
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/require.js?1649687610584 HTTP/1.1" 200 23902 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/web-runtime-6766268e.js HTTP/1.1" 200 27271 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/manifest.json HTTP/1.1" 200 1297 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/chunks/error-992e7064.js HTTP/1.1" 200 1585 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/chunks/cache-40bfe919.js HTTP/1.1" 200 19935 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/chunks/useRoute-1812bd9a.js HTTP/1.1" 200 2842 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/img/app.png HTTP/1.1" 200 6756 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:14 +0000] "GET /index.php/apps/web/js/chunks/vendor-569e5121.js HTTP/1.1" 200 553105 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:15 +0000] "GET /index.php/apps/web/config.json HTTP/1.1" 500 10440 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:15 +0000] "GET /index.php/apps/web/themes/owncloud/assets/logo.svg HTTP/1.1" 200 10947 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:15 +0000] "GET /index.php/apps/web/themes/owncloud/assets/favicon.jpg HTTP/1.1" 200 1633 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"
172.31.46.134 - - [31/May/2022:18:04:15 +0000] "GET /index.php/apps/web/themes/owncloud/assets/loginBackground.jpg HTTP/1.1" 200 89234 "https://storage.coursepage.com/index.php/apps/web/index.html" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36"

ownCloud log (data/owncloud.log)

{"reqId":"Yn5E796cSBnICnmrDT50","level":3,"time":"2022-05-31T18:04:15+00:00","remoteAddr":"172.31.46.134","user":"andres","app":"PHP","method":"GET","url":"\/index.php\/apps\/web\/config.json","message":"file_get_contents(\/var\/www\/owncloud\/config\/config.json): failed to open stream: No such file or directory at \/var\/www\/owncloud\/apps\/web\/lib\/Controller\/ConfigController.php#73"}
{"reqId":"Yn5E796cSBnICnmrDT50","level":3,"time":"2022-05-31T18:04:15+00:00","remoteAddr":"172.31.46.134","user":"andres","app":"index","method":"GET","url":"\/index.php\/apps\/web\/config.json","message":"Exception: {\"Exception\":\"TypeError\",\"Message\":\"Argument 1 passed to OCA\\\\Web\\\\Controller\\\\ConfigController::addOC10AppsToConfig() must be of the type array, null given, called in \\\/var\\\/www\\\/owncloud\\\/apps\\\/web\\\/lib\\\/Controller\\\/ConfigController.php on line 75\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/web\\\/lib\\\/Controller\\\/ConfigController.php(75): OCA\\\\Web\\\\Controller\\\\ConfigController->addOC10AppsToConfig()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(170): OCA\\\\Web\\\\Controller\\\\ConfigController->getConfig()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(100): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(928): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/web\\\/lib\\\/Controller\\\/ConfigController.php\",\"Line\":95}"}

Browser log


GET https://storage.coursepage.com/index.php/apps/web/config.json 500

So I’m looking at the file apps/web/lib/Controller/ConfigController.php that shows an error on the data/owncloud.log:

public function getConfig(): JSONResponse {
        try {
            $configFile = \OC::$SERVERROOT . '/config/config.json';
            $configContent = \file_get_contents($configFile);
            $configAssoc = \json_decode($configContent, true);
            $extendedConfig = $this->addOC10AppsToConfig($configAssoc);
            $response = new JSONResponse($extendedConfig);
                        $response->addHeader('Cache-Control', 'max-age=0, no-cache, no-store, must-revalidate');
                        $response->addHeader('Pragma', 'no-cache');
                        $response->addHeader('Expires', 'Wed, 11 Jan 1984 05:00:00 GMT');
                //      $response->addHeader('X-Frame-Options', 'DENY');
                        return $response;
        } catch(\Exception $e) {
            $this->logger->logException($e, ['app' => 'web']);
            return new JSONResponse(["message" => $e->getMessage()], Http::STATUS_NOT_FOUND);
        }
    }

    /**
     * Add enabled OC10 apps to the loaded config. This ensures that they are
     * listed in the app switcher menu.
     *
     * @param array $config
     * @return array
     */
    private function addOC10AppsToConfig(array $config): array {
        $apps = $config['applications'] ?? [];

This line here $configFile = \OC::$SERVERROOT . '/config/config.json'; is this supposed to be config.php?

There’s no config/config.json on my /var/www/owncloud, but the docs here say there should be one Deploy as an app in ownCloud 10 | ownCloud. I think I might have put it on config.php, oh man, so many configs, let me create the json one.

1 Like

Hey, you’re correct, you need the config.json as additional config file which is only for ownCloud Web / has nothing to do with the config.php. The guide that you found should fill you in on all necessary details. Please reach out if something doesn’t work!