flipboxfactory / craft-element-lists

Element List Field Type for Craft CMS
Other
6 stars 3 forks source link

Request must accept JSON in response #9

Open tadward opened 5 years ago

tadward commented 5 years ago

When using a User List field, I receive a flash message of 'An unknown error occurred'. Further investigation shows that in the browser console I am getting a 500 Internal Server Error

This error is: Request must accept JSON in response

Below is my stack trace:

yii\web\BadRequestHttpException: Request must accept JSON in response in /craft/vendor/craftcms/cms/src/web/Controller.php:345
Stack trace:
#0 /PATH/craft/vendor/craftcms/cms/src/controllers/BaseElementsController.php(35): craft\web\Controller->requireAcceptsJson()
#1 /PATH/craft/vendor/flipboxfactory/craft-element-lists/src/controllers/ElementIndexesController.php(63): craft\controllers\BaseElementsController->init()
#2 /PATH/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): flipbox\craft\element\lists\controllers\ElementIndexesController->init()
#3 /PATH/craft/vendor/yiisoft/yii2/base/Controller.php(86): yii\base\BaseObject->__construct(Array)
#4 [internal function]: yii\base\Controller->__construct('element-indexes', Object(flipbox\craft\element\lists\ElementList), Array)
#5 /PATH/craft/vendor/yiisoft/yii2/di/Container.php(376): ReflectionClass->newInstanceArgs(Array)
#6 /PATH/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('flipbox\\craft\\e...', Array, Array)
#7 /PATH/craft/vendor/yiisoft/yii2/BaseYii.php(345): yii\di\Container->get('flipbox\\craft\\e...', Array)
#8 /PATH/craft/vendor/yiisoft/yii2/base/Module.php(642): yii\BaseYii::createObject('flipbox\\craft\\e...', Array)
#9 /PATH/craft/vendor/yiisoft/yii2/base/Module.php(596): yii\base\Module->createControllerByID('element-indexes')
#10 /PATH/craft/vendor/yiisoft/yii2/base/Module.php(588): yii\base\Module->createController('get-elements')
#11 /PATH/craft/vendor/yiisoft/yii2/base/Module.php(522): yii\base\Module->createController('element-indexes...')
#12 /PATH/craft/vendor/craftcms/cms/src/web/Application.php(299): yii\base\Module->runAction('element-lists/e...', Array)
#13 /PATH/craft/vendor/craftcms/cms/src/web/Application.php(566): craft\web\Application->runAction('element-lists/e...', Array)
#14 /PATH/craft/vendor/craftcms/cms/src/web/Application.php(278): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#15 /PATH/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#16 /PATH/public_html/index.php(21): yii\base\Application->run()
#17 {main}

Thoughts on what is causing this?

Craft 3.2.10 Element Lists 2.2.0

nateiler commented 5 years ago

Hi Tad,

Sorry for this slipping by me.

I just loaded up the versions you specified. I wasn't able to replicate the JSON error that you indicated (however I found and patched something else). Are you seeing this notice when the page loads or when trying to add a user?

Craft 3.2.x introduced an issue that I pushed up to a 2.2.1 release. I don't think it's related, but can you updated to 2.2.1? Once you've done that, I'd like to see the actual browser post that's causing the error (from your browser console). It seems the header isn't getting sent correctly (although this is using the exact same functionality as native element indexes).

tadward commented 5 years ago

I was able to get this working on my local. However, I am unable to update to Craft 3.3+

nateiler commented 5 years ago

There is a hard limit preventing Craft 3.3 at the moment. We rely on the underlying Craft relational field type; and when changes there are made it may break our plugin (until we get a patch out). We haven't tested on version 3.3 much.

We also have a Element List 3.0 release which will likely be the supporting release for Craft 3.3.