You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm updating a project to Craft 4 and have hit this error related to Blitz cache.
One particular page on the site is returning a 500 Internal Server Error and falling back to the error template.
In web.log I can see a TypeError was thrown by Blitz:
info 1702434930 [-][-][-][error][TypeError] putyourlightson\blitz\models\GenerateDataModel::addElementId(): Argument #1 ($elementId) must be of type int, null given, called in /var/www/html/vendor/putyourlightson/craft-blitz/src/models/GenerateDataModel.php on line 106 at /var/www/html/vendor/putyourlightson/craft-blitz/src/models/GenerateDataModel.php:92
info 1702434930 [-][-][-][warning][application] Request context:
info $_GET = []
info
info $_POST = []
info
info $_FILES = []
info
info $_COOKIE = [
info '..._username' => '...'
info '_gcl_au' => '...'
info '_fbp' => '...'
info 'CRAFT_CSRF_TOKEN' => '...'
info 'CraftSessionId' => '...'
info '..._identity' => '...'
info 'SERVD_LOGGED_IN_STATUS' => '1'
info ]
info
info $_SESSION = [
info '...__flash' => []
info '...__token' => '...'
info '...__id' => 1
info '__authKey' => '...'
info '...__expire' => 1703644529
info '__duration' => 1209600
info 'twofactorauth_verified' => 1702434710
info ]
info Stack trace:
info #0 /var/www/html/vendor/putyourlightson/craft-blitz/src/models/GenerateDataModel.php:106
info #1 /var/www/html/vendor/putyourlightson/craft-blitz/src/services/GenerateCacheService.php:210
info #2 /var/www/html/vendor/putyourlightson/craft-blitz/src/services/GenerateCacheService.php:128
info #3 /var/www/html/vendor/yiisoft/yii2/base/Event.php:312
info #4 /var/www/html/vendor/yiisoft/yii2/base/Component.php:642
info #5 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php:1986
info #6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php:3082
info #7 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php:1542
info #8 /var/www/html/vendor/yiisoft/yii2/db/Query.php:251
info #9 /var/www/html/vendor/craftcms/cms/src/db/Query.php:247
info #10 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php:1581
info #11 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php:1607
info #12 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php:129
info #13 /var/www/html/storage/runtime/compiled_templates/96/96d179221a63c83b3dd530129b090f59.php:48
info #14 /var/www/html/vendor/twig/twig/src/Template.php:394
info #15 /var/www/html/vendor/twig/twig/src/Template.php:367
info #16 /var/www/html/vendor/twig/twig/src/Template.php:379
info #17 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php:40
info #18 /var/www/html/vendor/twig/twig/src/Environment.php:277
info #19 /var/www/html/vendor/craftcms/cms/src/web/View.php:482
info #20 /var/www/html/vendor/craftcms/cms/src/web/View.php:535
info #21 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php:57
info #22 /var/www/html/vendor/yiisoft/yii2/web/Response.php:1100
info #23 /var/www/html/vendor/craftcms/cms/src/web/Response.php:337
info #24 /var/www/html/vendor/yiisoft/yii2/web/Response.php:340
info #25 /var/www/html/vendor/yiisoft/yii2/base/Application.php:390
info #26 /var/www/html/web/index.php:12
KarlBishop
changed the title
GenerateDataModel::addElementId(): Argument #1 ($elementId) must be of type int, null givenArgument
GenerateDataModel::addElementId(): Argument #1 ($elementId) must be of type int, null given
Dec 13, 2023
The element id might be null, if elements are fetched without id (like Entry::find()->section('xxx')->select(['name'])). We had the same issue. Thanks @bencroker for the fix!
I'm updating a project to Craft 4 and have hit this error related to Blitz cache.
One particular page on the site is returning a
500 Internal Server Error
and falling back to the error template.In web.log I can see a TypeError was thrown by Blitz:
The site is hosted on Servd and we followed their guide to integrate Blitz Cache with the Servd Static Cache:
https://servd.host/docs/caching-with-blitz
We're currently on:
Craft CMS 4.5.11.1
Blitz 4.9.3
Any ideas what could cause this?
The text was updated successfully, but these errors were encountered: