Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.9.4]: project-config rebuild and apply error: unknown methode #15050

Closed
TurboThomsen opened this issue May 22, 2024 · 1 comment
Closed

[4.9.4]: project-config rebuild and apply error: unknown methode #15050

TurboThomsen opened this issue May 22, 2024 · 1 comment

Comments

@TurboThomsen
Copy link

TurboThomsen commented May 22, 2024

What happened?

error on project-config/rebuild

Stacktrace:

2024-05-22 16:00:15 [console.ERROR] [yii\base\UnknownMethodException] yii\base\UnknownMethodException: Calling unknown method: craft\console\Request::getQueryParam() in /app/vendor/yiisoft/yii2/base/Component.php:300
Stack trace:
#0 /app/modules/site/eventHandlers/EntryEvents.php(32): yii\base\Component->__call('getQueryParam', Array)
#1 /app/modules/site/eventHandlers/EntryEvents.php(119): modules\site\eventHandlers\EntryEvents->isTgmSite()
#2 [internal function]: modules\site\eventHandlers\EntryEvents->modules\site\eventHandlers\{closure}(Object(yii\base\Event))
#3 /app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(yii\base\Event))
#4 /app/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger('craft\\fields\\Dr...', 'init', Object(yii\base\Event))
#5 /app/vendor/craftcms/cms/src/base/Model.php(89): yii\base\Component->trigger('init')
#6 /app/vendor/craftcms/cms/src/base/Field.php(209): craft\base\Model->init()
#7 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\base\Field->init()
#8 /app/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct(Array)
#9 /app/vendor/craftcms/cms/src/fields/BaseOptionsField.php(109): craft\base\Model->__construct(Array)
#10 [internal function]: craft\fields\BaseOptionsField->__construct(Array)
#11 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)
#12 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\fields\\Dr...', Array, Array)
#13 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\fields\\Dr...', Array, Array)
#14 /app/vendor/craftcms/cms/src/Craft.php(59): yii\BaseYii::createObject(Array, Array)
#15 /app/vendor/craftcms/cms/src/helpers/Component.php(143): Craft::createObject(Array)
#16 /app/vendor/craftcms/cms/src/services/Fields.php(598): craft\helpers\Component::createComponent(Array, 'craft\\base\\Fiel...')
#17 /app/vendor/craftcms/cms/src/services/Fields.php(625): craft\services\Fields->createField(Array)
#18 [internal function]: craft\services\Fields->craft\services\{closure}(Array, 131)
#19 /app/vendor/craftcms/cms/src/base/MemoizableArray.php(90): call_user_func(Object(Closure), Array, 131)
#20 /app/vendor/craftcms/cms/src/base/MemoizableArray.php(171): craft\base\MemoizableArray->normalizeByKey(131)
#21 /app/vendor/craftcms/cms/src/services/Fields.php(719): craft\base\MemoizableArray->firstWhere('uid', 'ca067c6f-9149-4...', true)
#22 /app/vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(113): craft\services\Fields->getFieldByUid('ca067c6f-9149-4...')
#23 /app/vendor/yiisoft/yii2/base/Component.php(180): craft\fieldlayoutelements\CustomField->setFieldUid('ca067c6f-9149-4...')
#24 /app/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('fieldUid', 'ca067c6f-9149-4...')
#25 /app/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\fieldlayoutelements\CustomField), Array)
#26 /app/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct(Array)
#27 /app/vendor/craftcms/cms/src/fieldlayoutelements/BaseField.php(59): craft\base\Model->__construct(Array)
#28 /app/vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(39): craft\fieldlayoutelements\BaseField->__construct(Array)
#29 [internal function]: craft\fieldlayoutelements\CustomField->__construct(NULL, Array)
#30 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)
#31 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\fieldlayo...', Array, Array)
#32 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\fieldlayo...', Array, Array)
#33 /app/vendor/craftcms/cms/src/Craft.php(59): yii\BaseYii::createObject(Array, Array)
#34 /app/vendor/craftcms/cms/src/services/Fields.php(1267): Craft::createObject(Array)
#35 /app/vendor/craftcms/cms/src/models/FieldLayoutTab.php(289): craft\services\Fields->createLayoutElement(Array)
#36 /app/vendor/yiisoft/yii2/base/Component.php(180): craft\models\FieldLayoutTab->setElements(Array)
#37 /app/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('elements', Array)
#38 /app/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\models\FieldLayoutTab), Array)
#39 /app/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct(Array)
#40 /app/vendor/craftcms/cms/src/models/FieldLayoutTab.php(124): craft\base\Model->__construct(Array)
#41 /app/vendor/craftcms/cms/src/services/Fields.php(1209): craft\models\FieldLayoutTab->__construct(Array)
#42 /app/vendor/craftcms/cms/src/services/Fields.php(1107): craft\services\Fields->_createLayoutTabFromRow(Array, true)
#43 [internal function]: craft\services\Fields->craft\services\{closure}(Array)
#44 /app/vendor/craftcms/cms/src/services/Fields.php(1106): array_map(Object(Closure), Array)
#45 [internal function]: craft\services\Fields->craft\services\{closure}(Array, 13)
#46 /app/vendor/craftcms/cms/src/base/MemoizableArray.php(90): call_user_func(Object(Closure), Array, 13)
#47 /app/vendor/craftcms/cms/src/base/MemoizableArray.php(171): craft\base\MemoizableArray->normalizeByKey(13)
#48 /app/vendor/craftcms/cms/src/services/Fields.php(1126): craft\base\MemoizableArray->firstWhere('id', 20)
#49 /app/vendor/craftcms/cms/src/behaviors/FieldLayoutBehavior.php(123): craft\services\Fields->getLayoutById(20)
#50 /app/vendor/craftcms/cms/src/models/MatrixBlockType.php(109): craft\behaviors\FieldLayoutBehavior->getFieldLayout()
#51 /app/vendor/craftcms/cms/src/models/MatrixBlockType.php(179): craft\models\MatrixBlockType->getFieldLayout()
#52 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(2019): craft\models\MatrixBlockType->getConfig()
#53 /app/vendor/craftcms/cms/src/services/ProjectConfig.php(1219): craft\services\ProjectConfig->_getMatrixBlockTypeData()
#54 /app/vendor/craftcms/cms/src/console/controllers/ProjectConfigController.php(444): craft\services\ProjectConfig->rebuild()
#55 [internal function]: craft\console\controllers\ProjectConfigController->actionRebuild()
#56 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#57 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#58 /app/vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction('rebuild', Array)
#59 /app/vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\console\Controller->runAction('rebuild', Array)
#60 /app/vendor/craftcms/cms/src/console/Controller.php(216): craft\console\Controller->traitRunAction('rebuild', Array)
#61 /app/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('rebuild', Array)
#62 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('project-config/...', Array)
#63 /app/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction('project-config/...', Array)
#64 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('project-config/...', Array)
#65 /app/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest(Object(craft\console\Request))
#66 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest(Object(craft\console\Request))
#67 /app/craft(24): yii\base\Application->run()
#68 {main} {"memory":28109592,"exception":"[object] (yii\\base\\UnknownMethodException(code: 0): Calling unknown method: craft\\console\\Request::getQueryParam() at /app/vendor/yiisoft/yii2/base/Component.php:300)"}

Craft CMS version

4.9.4

PHP version

8.2

Operating system and version

Linux 5.15.5-0-virt

Database type and version

MariaDB 10.6.17

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.1-13)

Installed plugins and versions

"ether/seo": "4.2.2",
"vlucas/phpdotenv": "5.6.0",
"craftcms/redactor": "3.0.4",
"mmikkel/cp-field-inspect": "1.4.4",
"sebastianlenz/linkfield": "2.1.5",
"nesbot/carbon": "3.3.1",
"verbb/super-table": "3.0.14"
@brandonkelly
Copy link
Member

Looks like this is coming from your modules\site\eventHandlers\EntryEvents::isTgmSite() method, which is calling Craft::$app->request->getQueryParam(). However Craft::$app->request will return a craft\console\Request object for CLI requests, which doesn’t have a getQueryParam() method.

You can fix by ensuring it’s a web request before calling that method.

if (!Craft::$app->request->isConsoleRequest) {
    $param = Craft::$app->request->getQueryParam('paramName');
    // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants