Having a problem with the panel after install

I’m in the midst of setting up Kirby 3 and I’ve run into a problem…

So, I’ve created a custom directory setup here based on the one in the docs:

<?php

$base = dirname(__DIR__, 1);

include $base . '/vendor/autoload.php';

$roots = [
    'roots' => [
        'index'    => __DIR__,
        'base'     => $base,
        'content'  => $base . '/content',
        'site'     => $base . '/site',
        'storage'  => $storage = $base . '/storage',
        'accounts' => $storage . '/accounts',
        'cache'    => $storage . '/cache',
        'sessions' => $storage . '/sessions',
    ],
];

$kirby = new Kirby($roots);

echo $kirby->render();

The front page works fine.

The panel however gives an error after I login:

Cannot read property ‘access’ of null. which is this piece of code:

                attrs: {
                    "aria-current": t.$store.state.view === i
                }
            }, [s("k-dropdown-item", {
                attrs: {
                    disabled: !1 === t.$permissions.access[i],
                    icon: e.icon,
                    link: e.link
                }
            }, [t._v(" " + t._s(t.menuTitle(e, i)) + " ")])], 1) : t._e()]
        }

The response from the API to the panel with my account, which is where this data comes from (I’m assuming) looks like this:

{
  "code": 200,
  "data": {
    "ascii": {
<snip>
    },
    "authStatus": {
      "challenge": null,
      "email": "XXXX@XXXXX.de",
      "status": "active"
    },
    "defaultLanguage": "en",
    "isInstallable": true,
    "isInstalled": true,
    "isLocal": false,
    "isOk": true,
    "kirbytext": true,
    "languages": [],
    "license": "XXXXX",
    "locales": {
<snip>
    },
    "loginMethods": [
      "password"
    ],
    "multilang": false,
    "requirements": {
      "accounts": true,
      "content": true,
      "curl": true,
      "sessions": true,
      "mbstring": true,
      "media": true,
      "php": true,
      "server": true
    },
    "site": "Site",
    "slugs": [],
    "title": "This is the site title",
    "translation": {
      "author": "Kirby Team",
      "data": {
<snip>
      },
      "direction": "ltr",
      "id": "en",
      "name": "English"
    },
    "user": {
      "avatar": null,
      "content": [],
      "email": "XXXX@XXXXX.de",
      "id": "Foh8w0E7",
      "language": "en",
      "name": "XXXX XXXX",
      "next": null,
      "options": {
        "create": false,
        "changeEmail": true,
        "changeLanguage": true,
        "changeName": true,
        "changePassword": true,
        "changeRole": false,
        "delete": false,
        "update": true
      },
      "prev": null,
      "role": {
        "description": "The admin has all rights",
        "name": "admin",
        "permissions": {
          "access": {
            "panel": true,
            "settings": true,
            "site": true,
            "users": true
          },
          "files": {
            "changeName": true,
            "create": true,
            "delete": true,
            "read": true,
            "replace": true,
            "update": true
          },
          "languages": {
            "create": true,
            "delete": true
          },
          "pages": {
            "changeSlug": true,
            "changeStatus": true,
            "changeTemplate": true,
            "changeTitle": true,
            "create": true,
            "delete": true,
            "duplicate": true,
            "preview": true,
            "read": true,
            "sort": true,
            "update": true
          },
          "site": {
            "changeTitle": true,
            "update": true
          },
          "users": {
            "changeEmail": true,
            "changeLanguage": true,
            "changeName": true,
            "changePassword": true,
            "changeRole": true,
            "create": true,
            "delete": true,
            "update": true
          },
          "user": {
            "changeEmail": true,
            "changeLanguage": true,
            "changeName": true,
            "changePassword": true,
            "changeRole": true,
            "delete": true,
            "update": true
          }
        },
        "title": "Admin"
      },
      "username": "XXXXXXX"
    },
    "version": "3.5.1"
  },
  "status": "ok",
  "type": "model"
}

Which seems correct to me…

Any tips on where to look further?

Okay, I’ve done some more digging.

    var vy = s("82f1")
      , $y = s("8c4f")
      , yy = function(t, e, s) {
        ry.dispatch("system/load").then(()=>{
            const e = ry.state.user.current;
            if (!e)
                return ry.dispatch("user/visit", t.path),
                ry.dispatch("user/logout"),
                !1;
            const i = e.permissions.access;
            return !1 === i.panel ? (window.location.href = O.site,
            !1) : !1 === i[t.meta.view] ? (ry.dispatch("notification/error", {
                message: I["a"].i18n.translate("error.access.view")
            }),
            s(!1 === i.site ? "/account" : "/")) : void s()
        }
        )
    };

The error is now happening here. When I look at the ry.state.user.current, it doesn’t have a permissions property. The permissions property is under role. ie, e.role.permissions.access would work.

Is it possible that I’m somehow using the wrong version of the panel?

Should I just try a fresh install?

If I’m installing kirby via composer, should the kirby folder be in my .gitignore?

Okay, did some more digging. If I clear the session storage (on the file system) the very first time I login I get a different error.

Cannot read property 'tabs' of undefined

the problem seems to be that it can’t read the site blueprint. t.site has no blueprint property.

        }, [t._v(" " + t._s(t.$t("open")) + " ")]), s("k-languages-dropdown")], 1)], 1), t.site.url ? s("k-sections", {
            attrs: {
                blueprint: t.site.blueprint.name,
                empty: t.$t("site.blueprint"),
                tab: t.tab,
                tabs: t.tabs,
                parent: "site"
            },

I’m going to look at the Vue App source and dig a little more.

The site API returns the following:

{
  "code": 200,
  "data": {
    "content": {
      "title": "Site Title"
    },
    "options": {
      "changeTitle": true,
      "update": true
    },
    "title": "Site Title",
    "url": "https:\/\/local3.XXXXX.de"
  },
  "status": "ok",
  "type": "model"
}

FYI, this is what I see when I log into the site the first time.

What is also interesting is that the site warns that it’s unregistered, even though there is a valid .license file in site/config.

Can this be reproduced with a Starterkit and your index.php setup?

I think I saw something like this and it was a problem with blueprint YAML formatting, I can’t quite remember but it was something todo with dashes in the yaml.

thing:
- anotherthing

Solution was to remove the dash and replace with a space, it only happened on latest few versions of Kirby.

thing:
  anotherthing

Hope this helps?

Does this error only pop up with the custom folder setup?

Yes. If I reset the custom folder setup, it works fine.

I could try to replicate with the starter kit, but I’m just using the plainkit right now, with an unchanged plainkit content folder.

Okay… I did some additional digging, the structure of the API response for starterkit /api/system?view=panel and my install /api/system?view=panel is different between the two.

On the startkit, the user.permissions property exists. For my install, it’s user.role.permissions.

What would cause that?

The differences are easier to see in the response to the site api call.

My site:

{
  "code": 200,
  "data": {
    "content": {
      "title": "This is the site title"
    },
    "options": {
      "changeTitle": true,
      "update": true
    },
    "title": "This is the site title",
    "url": "https:\/\/local3.kautionsfrei.de"
  },
  "status": "ok",
  "type": "model"
}

The starterkit:

{
  "code": 200,
  "data": {
    "blueprint": {
      "name": "site",
      "options": {
        "changeTitle": null,
        "update": null
      },
      "tabs": [
        {
          "columns": [
            {
              "width": "1\/2",
              "sections": {
                "albums": {
                  "type": "pages",
                  "headline": "Photography",
                  "parent": "kirby.page(\"photography\")",
                  "size": "small",
                  "info": "{{ page.images.count }} image(s)",
                  "layout": "cards",
                  "template": "album",
                  "empty": "No albums yet",
                  "image": {
                    "query": "page.cover",
                    "cover": true,
                    "ratio": "5\/4"
                  },
                  "name": "albums"
                }
              }
            },
            {
              "width": "1\/2",
              "sections": {
                "notes": {
                  "type": "pages",
                  "headline": "Notes",
                  "parent": "kirby.page(\"notes\")",
                  "info": "{{ page.published }}",
                  "template": "note",
                  "empty": "No notes yet",
                  "sortBy": "date desc",
                  "image": {
                    "query": "page.cover",
                    "cover": true,
                    "ratio": "3\/2"
                  },
                  "name": "notes"
                },
                "pages": {
                  "type": "pages",
                  "create": "default",
                  "templates": [
                    "about",
                    "home",
                    "default"
                  ],
                  "name": "pages"
                }
              }
            }
          ],
          "icon": null,
          "label": "Main",
          "name": "main"
        }
      ],
      "title": "Site"
    },
    "content": {
      "title": "M\u00e6gazine"
    },
    "options": {
      "changeTitle": true,
      "update": true
    },
    "previewUrl": "http:\/\/localhost:8000",
    "title": "M\u00e6gazine",
    "url": "http:\/\/localhost:8000"
  },
  "status": "ok",
  "type": "model"
}

So the whole blueprint part is missing. What if you define each site subfolder explicitly in your site.php?

1 Like

No better. This is what my index.php looks like now (I assume you meant index.php and not site.php)

<?php

/**
 * __DIR__ is /var/www/app/public or the webroot
 * dirname(__DIR__, 1) is /var/www/app or the root of the project
 */

$webroot = __DIR__;
$base    = dirname($webroot, 1);
$site    = $base . '/site';
$storage = $base . '/storage';

include $base . '/vendor/autoload.php';

$roots = [
    'roots' => [
        'index'       => $webroot,
        'base'        => $base,
        'content'     => $base . '/content',
        'site'        => $site,
        'blueprints'  => $site . '/blueprints',
        'config'      => $site . '/config',
        'controllers' => $site . '/controllers',
        'plugins'     => $site . '/plugins',
        'snippets'    => $site . '/snippets',
        'templates'   => $site . '/templates',
        'storage'     => $storage,
        'accounts'    => $storage . '/accounts',
        'cache'       => $storage . '/cache',
        'sessions'    => $storage . '/sessions',
    ],
];

$kirby = new Kirby($roots);

echo $kirby->render();

This is super weird. I’m honestly clueless why this happens. I would need to have a closer look at the setup to try to understand this.

If you have time we could do a screen share.

Is there a chance to look at it asynchronously? Homeschooling is taking a toll over here and my work days are super short. Maybe it would also help to just replicate your setup with the plainkit / starterkit and send me a zip with that.

100% Verstanden.

I’ll work on bundling it up.

1 Like

Bastian found the solution:

 # site links
 location / {
-    try_files $uri $uri/ /index.php?$is_args$args;
+    try_files $uri $uri/ /index.php$is_args$args;
 }

 location ~ \.php$ {

The problem was in the NGINX config.