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

"Element query executed before Craft is fully initialized" warnings in log #456

Closed
tr-lg opened this issue Jul 21, 2023 · 1 comment
Closed
Assignees
Labels
type: bug Something isn't working

Comments

@tr-lg
Copy link

tr-lg commented Jul 21, 2023

On every request the following one or two warnings are added to the Craft CMS web log file:

Warning 1 + stack trace

2023-07-21 08:34:29 [web.WARNING] [craft\elements\db\ElementQuery::prepare] Element query executed before Craft is fully initialized.
Stack trace:
#0 /app/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare()
#1 /app/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build()
#2 /app/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Query->createCommand()
#3 /app/vendor/craftcms/cms/src/db/Query.php(275): yii\db\Query->one()
#4 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1590): craft\db\Query->one()
#5 /app/vendor/craftcms/cms/src/elements/User.php(525): craft\elements\db\ElementQuery->one()
#6 /app/vendor/yiisoft/yii2/web/User.php(698): craft\elements\User::findIdentity()
#7 /app/vendor/craftcms/cms/src/web/User.php(489): yii\web\User->renewAuthStatus()
#8 /app/vendor/yiisoft/yii2/web/User.php(199): craft\web\User->renewAuthStatus()
#9 /app/vendor/yiisoft/yii2/web/User.php(367): yii\web\User->getIdentity()
#10 /app/vendor/craftcms/cms/src/web/User.php(204): yii\web\User->getIsGuest()
#11 /app/vendor/craftcms/cms/src/services/Sites.php(1237): craft\web\User->getIsGuest()
#12 /app/vendor/craftcms/cms/src/services/Sites.php(417): craft\services\Sites->_allSites()
#13 /app/vendor/acclaro/translations/src/services/repository/SiteRepository.php(16): craft\services\Sites->getAllSiteIds()
#14 /app/vendor/acclaro/translations/src/services/App.php(191): acclaro\translations\services\repository\SiteRepository->__construct()
#15 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): acclaro\translations\services\App->init()
#16 /app/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct()
#17 craft\base\Model->__construct()
#18 /app/vendor/yiisoft/yii2/di/Container.php(411): ReflectionClass->newInstanceArgs()
#19 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#20 /app/vendor/yiisoft/yii2/BaseYii.php(345): yii\di\Container->get()
#21 /app/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#22 /app/vendor/yiisoft/yii2/base/Module.php(769): yii\di\ServiceLocator->get()
#23 /app/vendor/acclaro/translations/src/Translations.php(100): yii\base\Module->get()
#24 acclaro\translations\Translations->acclaro\translations\{closure}()
#25 /app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()
#26 /app/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger()
#27 /app/vendor/craftcms/cms/src/services/Plugins.php(275): yii\base\Component->trigger()
#28 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1580): craft\services\Plugins->loadPlugins()
#29 /app/vendor/craftcms/cms/src/web/Application.php(108): craft\web\Application->_postInit()
#30 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#31 /app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct()
#32 yii\base\Application->__construct()
#33 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs()
#34 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#35 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#36 /app/vendor/craftcms/cms/src/Craft.php(54): yii\BaseYii::createObject()
#37 /app/vendor/craftcms/cms/bootstrap/bootstrap.php(256): Craft::createObject()
#38 /app/vendor/craftcms/cms/bootstrap/web.php(40): require()
#39 /app/web/index.php(25): require() {"memory":22540616} 

Warning 2 + stack trace

2023-07-21 08:34:29 [web.WARNING] [craft\elements\db\ElementQuery::prepare] Element query executed before Craft is fully initialized.
Stack trace:
#0 /app/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare()
#1 /app/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build()
#2 /app/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand()
#3 /app/vendor/craftcms/cms/src/db/Query.php(247): yii\db\Query->all()
#4 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1567): craft\db\Query->all()
#5 /app/vendor/acclaro/translations/src/services/repository/OrderRepository.php(129): craft\elements\db\ElementQuery->all()
#6 /app/vendor/acclaro/translations/src/Translations.php(435): acclaro\translations\services\repository\OrderRepository->getCompleteOrders()
#7 /app/vendor/acclaro/translations/src/Translations.php(385): acclaro\translations\Translations->_includeUniversalResources()
#8 /app/vendor/acclaro/translations/src/Translations.php(321): acclaro\translations\Translations->_includeResources()
#9 /app/vendor/acclaro/translations/src/Translations.php(103): acclaro\translations\Translations->installEventListeners()
#10 acclaro\translations\Translations->acclaro\translations\{closure}()
#11 /app/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()
#12 /app/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger()
#13 /app/vendor/craftcms/cms/src/services/Plugins.php(275): yii\base\Component->trigger()
#14 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1580): craft\services\Plugins->loadPlugins()
#15 /app/vendor/craftcms/cms/src/web/Application.php(108): craft\web\Application->_postInit()
#16 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#17 /app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct()
#18 yii\base\Application->__construct()
#19 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs()
#20 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#21 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get()
#22 /app/vendor/craftcms/cms/src/Craft.php(54): yii\BaseYii::createObject()
#23 /app/vendor/craftcms/cms/bootstrap/bootstrap.php(256): Craft::createObject()
#24 /app/vendor/craftcms/cms/bootstrap/web.php(40): require()
#25 /app/web/index.php(25): require() {"memory":28461736} 

For some requests only warning 2 is logged, for others it's warning 1 and then 2. I haven't been able to find out why.

These warnings and the accompanying request context is blowing up our log files at multiple Megabytes per hour.

Plugin version: 3.2.8
Craft CMS version: 4.4.16.1
Nitro version: 2.0.8

@MerrittBoydston MerrittBoydston added the type: bug Something isn't working label Jul 21, 2023
@bhupeshappfoster bhupeshappfoster mentioned this issue Jul 26, 2023
12 tasks
@shnsumit
Copy link
Collaborator

@tr-lg
Thank you for taking the time to report the issue you encountered.

We are pleased to inform you that the reported issue has been successfully addressed and resolved in our latest release. To benefit from the fix, we kindly recommend updating to the most recent version of the plugin.

If you come across any further issues or have any additional feedback, please don't hesitate to let us know.

https://github.com/AcclaroInc/craft-translations/releases/tag/v3.2.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants