craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

A server error when reordering a structure #7952

Closed matanlevkowich closed 3 years ago

matanlevkowich commented 3 years ago

Description

I am getting an error message when trying to reorder a structure by dragging and dropping. The entry does move but but an alert appears saying A server error occurred.

Steps to reproduce

  1. Appears under any structure of category group that has the drag and drop option.
  2. The bug is only taking place on the live site in both dev/staging/production mode. Local site works fine.

Additional info

Plugin Version
MobileDetect 1.0.2
Redactor 2.8.7
SEO 3.7.1
Site Switcher 2.2.0

Screenshot 2021-05-18 at 20 13 49 (2)

brandonkelly commented 3 years ago

Please clear out your storage/logs folder on the server, reproduce the error, and then search storage/logs/web.log for [error], and paste in the full error, including its stack trace.

matanlevkowich commented 3 years ago

I have discovered that the bug is browser related. Normally I am working with Brave browser and it only happens in it. On other browsers the error doesn't take place so I am not sure if it is really needed to look into the problem. Here is the error from the log file anyhow:

2021-05-18 22:33:58 [-][3][-][error][yii\web\HttpException:403] yii\web\ForbiddenHttpException: User is not authorized to perform this action in /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/web/Controller.php:344
Stack trace:
#0 /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/controllers/StructuresController.php(57): craft\web\Controller->requireAuthorization('editStructure:1')
#1 /usr/www/users/lessmok/julia-k/vendor/yiisoft/yii2/base/Controller.php(179): craft\controllers\StructuresController->beforeAction(Object(yii\base\InlineAction))
#2 /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('move-element', Array)
#3 /usr/www/users/lessmok/julia-k/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction('move-element', Array)
#4 /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/web/Application.php(278): yii\base\Module->runAction('structures/move...', Array)
#5 /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/web/Application.php(581): craft\web\Application->runAction('structures/move...', Array)
#6 /usr/www/users/lessmok/julia-k/vendor/craftcms/cms/src/web/Application.php(257): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#7 /usr/www/users/lessmok/julia-k/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#8 /usr/www/users/lessmok/julia-k/web/index.php(22): yii\base\Application->run()
#9 {main}
brandonkelly commented 3 years ago

Ah, this has come up before: #2772

We haven’t gotten to the bottom of it yet, but please read through that and see if any of the comments help.

ccchapman commented 3 years ago

We had this error recently. In our case, sessions and cache were stored in Redis. The sites cache was cleared frequently. If you load the structure, you're authorized to move it at that time. When the cache was cleared, and thus the session permission, you'd be unable to move until you refresh. Our solution was to use separate Redis databases for cache and sessions.