Panel 500 errors after idle

hey community!

I have found a strange error in my panel, it appeared in 3.7.5 and now after updating also in 3.9.8 and it’s is reproducible on my site with the following steps:

  1. login to panel
  2. logout from panel
  3. keep login page open

after some time, the panel starts doing requests:
POST to https://mydomain.local/api/auth/ping (in version 3.9.8)
POST to https://mydomain.tld/api/auth (in version 3.7.5)

all these requests run into a timeout and return a 500 Internal Server Error and sometimes 503. This creates a loop, the request is started after some time again and producing the same error.

Initiator:
image

after this happens, I cannot login again, even with refresh. It only works after removing the session cookie, then everything works perfectly fine again.

What is happening here? Why are these requests running into an error?

This happens on my local machine as well as on my production server.

UPDATE
looks like I’ve found the issue:

I’m using the “completely different blueprint sets per user role” from Going beyond Kirby's permissions features | Kirby CMS.
There I made this changes to index.php:

$dir = __DIR__;

require 'kirby/bootstrap.php';

$kirby = new Kirby();

$currentUser = $kirby->user();

if ($currentUser && $currentUser->role()->name() === 'editor' ){
   $kirby = new Kirby([
       'roots' => [
           'blueprints' => $dir . '/site/plugins/role-blueprints/blueprints/editor/',
       ],
   ]);
} else {
   $kirby = new Kirby([
       'roots' => [
           'blueprints' => $dir . '/site/plugins/role-blueprints/blueprints/admin/',
       ],
   ]);
}

echo $kirby->render();

if I remove the if-block, the ping-requests work again.

There’s a better way to do this with programmable blueprints instead of creating two kirby instances: Programmable blueprints | Kirby CMS

Although that would mean that you have to spell them out or loop through all to register them.

but is there a way to fix it the way I’m using it now? Because it’s still in the guide, therefore I think it should work shomehow.
I didn’t get it working with programmable blueprints but anyway, I think this way should work too.

Yes, I will remove it now. It was never a great idea in the first place, just a way to make it work.

1 Like

as always, thanks for the great help!