ethercreative / simplemap

A beautifully simple map field type for Craft CMS.
Other
135 stars 48 forks source link

Call to a member function getMap() on null #61

Closed juresrpcic closed 6 years ago

juresrpcic commented 6 years ago

On a clean Craft 3 RC1 install, I get an error that breaks Control Panel entirely after creating a Simple Map field with default settings.

Internal Server Error
Call to a member function getMap() on null

Any ideas?

juresrpcic commented 6 years ago

Some additional information - I had a clean Craft 3 install but with other plugins installed when I got the error. I just tried a fresh install without any plugins + manually installed Simple Map with Composer and it worked without throwing that error.

Tam commented 6 years ago

That error suggests that the field type was being called in some way before the rest of the plugin had been initialised. It's most likely that one of the other plugins you had installed was causing this.

Could you let me know what other plugins you had installed?

georgejr commented 6 years ago

For me it caused: Redirect plugin for Craft 3 Turned off, and everything seems to be fine:)

juresrpcic commented 6 years ago

This is the list of plugins I have installed (doing some testing):

I tried to debug a bit more and turned all plugins off, I could create the Map field normally, then I turned them on one by one and couldn't replicate the original issue anymore. I'm sure it's another plugin causing this - if I find it (I'm not using Redirect like @georgejr ) I'll report it here.

Tam commented 6 years ago

Only a couple of other plugins then 😆

It would be worth checking your logs as well, as they will probably contain more information about the error. You can check your logs from within the Craft CP using Logs (shameless plug).

juresrpcic commented 6 years ago

A few 💯 ...

I did look at the logs but nothing really jumps at me, here is the relevant part if you find it useful:

017-12-07 17:22:18 [127.0.0.1][-][d926fc96af6a766c2527abc7fa34ad3d][error][Error] Error: Call to a member function getMap() on null in C:\web\istjames\vendor\ether\simplemap\src\fields\MapField.php:521
Stack trace:
#0 C:\web\istjames\vendor\craftcms\cms\src\elements\db\ElementQuery.php(1439): ether\simplemap\fields\MapField->modifyElementsQuery(Object(craft\elements\db\UserQuery), NULL)
#1 C:\web\istjames\vendor\craftcms\cms\src\elements\db\ElementQuery.php(897): craft\elements\db\ElementQuery->_joinContentTable('craft\\elements\\...')
#2 C:\web\istjames\vendor\yiisoft\yii2\db\QueryBuilder.php(109): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#3 C:\web\istjames\vendor\yiisoft\yii2\db\Query.php(129): yii\db\QueryBuilder->build(Object(craft\elements\db\UserQuery))
#4 C:\web\istjames\vendor\yiisoft\yii2\db\Query.php(259): yii\db\Query->createCommand(Object(craft\db\Connection))
#5 C:\web\istjames\vendor\craftcms\cms\src\db\Query.php(134): yii\db\Query->one(NULL)
#6 C:\web\istjames\vendor\craftcms\cms\src\elements\db\ElementQuery.php(1018): craft\db\Query->one(NULL)
#7 C:\web\istjames\vendor\craftcms\cms\src\elements\User.php(333): craft\elements\db\ElementQuery->one()
#8 C:\web\istjames\vendor\yiisoft\yii2\web\User.php(663): craft\elements\User::findIdentity('1')
#9 C:\web\istjames\vendor\craftcms\cms\src\web\User.php(375): yii\web\User->renewAuthStatus()
#10 C:\web\istjames\vendor\yiisoft\yii2\web\User.php(188): craft\web\User->renewAuthStatus()
#11 C:\web\istjames\vendor\yiisoft\yii2\web\User.php(333): yii\web\User->getIdentity()
#12 C:\web\istjames\vendor\am-impact\amcommand\src\CommandPalette.php(132): yii\web\User->getIsGuest()
#13 C:\web\istjames\vendor\am-impact\amcommand\src\CommandPalette.php(65): amimpact\commandpalette\CommandPalette->_registerPalette()
#14 C:\web\istjames\vendor\yiisoft\yii2\base\BaseObject.php(108): amimpact\commandpalette\CommandPalette->init()
#15 C:\web\istjames\vendor\yiisoft\yii2\base\Module.php(158): yii\base\BaseObject->__construct(Array)
#16 C:\web\istjames\vendor\craftcms\cms\src\base\Plugin.php(88): yii\base\Module->__construct('command-palette', Object(craft\web\Application), Array)
#17 [internal function]: craft\base\Plugin->__construct('command-palette', Object(craft\web\Application), Array)
#18 C:\web\istjames\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstanceArgs(Array)
#19 C:\web\istjames\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('amimpact\\comman...', Array, Array)
#20 C:\web\istjames\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get('amimpact\\comman...', Array, Array)
#21 C:\web\istjames\vendor\craftcms\cms\src\services\Plugins.php(777): yii\BaseYii::createObject(Array, Array)
#22 C:\web\istjames\vendor\craftcms\cms\src\services\Plugins.php(196): craft\services\Plugins->createPlugin('command-palette', Array)
#23 C:\web\istjames\vendor\craftcms\cms\src\base\ApplicationTrait.php(1167): craft\services\Plugins->loadPlugins()
#24 C:\web\istjames\vendor\craftcms\cms\src\web\Application.php(86): craft\web\Application->_init()
#25 C:\web\istjames\vendor\yiisoft\yii2\base\BaseObject.php(108): craft\web\Application->init()
#26 C:\web\istjames\vendor\yiisoft\yii2\base\Application.php(206): yii\base\BaseObject->__construct(Array)
#27 C:\web\istjames\vendor\craftcms\cms\src\web\Application.php(74): yii\base\Application->__construct(Array)
#28 [internal function]: craft\web\Application->__construct(Array)
#29 C:\web\istjames\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstanceArgs(Array)
#30 C:\web\istjames\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#31 C:\web\istjames\vendor\yiisoft\yii2\BaseYii.php(349): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#32 C:\web\istjames\vendor\craftcms\cms\bootstrap\bootstrap.php(231): yii\BaseYii::createObject(Array)
#33 C:\web\istjames\vendor\craftcms\cms\bootstrap\web.php(37): require('C:\\web\\istjames...')
#34 C:\web\istjames\public\index.php(20): require('C:\\web\\istjames...')
#35 {main}

Nice log-o on the Logs plugin 👍

juresrpcic commented 6 years ago

Hm, the log made me test again and I think it just might be Command Palette - am-impact/amcommand . If I just uninstall that one, I can create the Map field again. But funny enough, once I create the map field, I can re-enable Command Palette and then I can continue creating Map fields without errors. I'll submit this report to amcommand github as well...

Tam commented 6 years ago

Closing this, looks like it's fixed in Simple Map plugin breaks when Comand Palette enabled #33