putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
149 stars 36 forks source link

Setting unknown property: `CloudflarePurger::warmCacheDelay` #498

Closed kaspar-allenbach closed 1 year ago

kaspar-allenbach commented 1 year ago

I can't purge the cache anymore because this erorr message appears

It also appears when I want to access blitz settings. What is this?

yii\base\UnknownPropertyException: Setting unknown property: putyourlightson\blitz\drivers\purgers\CloudflarePurger::warmCacheDelay in /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('warmCacheDelay', '0')
#1 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(putyourlightson\blitz\drivers\purgers\CloudflarePurger), Array)
#2 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/craftcms/cms/src/base/Model.php(78): yii\base\BaseObject->__construct(Array)
#3 [internal function]: craft\base\Model->__construct(Array)
#4 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)
#5 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('putyourlightson...', Array, Array)
#6 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('putyourlightson...', Array, Array)
#7 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/craftcms/cms/src/Craft.php(54): yii\BaseYii::createObject(Array, Array)
#8 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/craftcms/cms/src/helpers/Component.php(122): Craft::createObject(Array)
#9 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/putyourlightson/craft-blitz/src/helpers/BaseDriverHelper.php(46): craft\helpers\Component::createComponent(Array, 'craft\\base\\Sava...')
#10 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/putyourlightson/craft-blitz/src/controllers/SettingsController.php(78): putyourlightson\blitz\helpers\BaseDriverHelper::createDriver('putyourlightson...', Array)
#11 [internal function]: putyourlightson\blitz\controllers\SettingsController->actionEdit()
#12 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#14 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('edit', Array)
#15 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/craftcms/cms/src/web/Application.php(302): yii\base\Module->runAction('blitz/settings/...', Array)
#16 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('blitz/settings/...', Array)
#17 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/craftcms/cms/src/web/Application.php(287): yii\web\Application->handleRequest(Object(craft\web\Request))
#18 /Users/atelierworkstation/Documents/git-local/atelier7/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /Users/atelierworkstation/Documents/git-local/atelier7/www/index.php(32): yii\base\Application->run()
#20 {main}
bencroker commented 1 year ago

What version of Blitz are you running? If 4.x, you’ll need to remove the warmCacheDelay setting as it was removed from the plugin in 4.0.0, see https://github.com/putyourlightson/craft-blitz/blob/develop/CHANGELOG.md#400---2022-05-04

Romanavr commented 1 year ago

@bencroker CraftCMS 4.4.8 Blitz 4.4.4 PHP 8.1 I'm getting the same error after upgrade from craft 3.x. on php craft up, after applying migrations when craft applying project-config changes. Any ideas how to fix this?

изображение

bencroker commented 1 year ago

Same as above, @Romanavr. You’ll need to remove the warmCacheDelay config setting in /config/blitz.php.

Romanavr commented 1 year ago

Same as above, @Romanavr. You’ll need to remove the warmCacheDelay config setting in /config/blitz.php.

@bencroker I don't have it in blitz config:

<?php

return [
  '*' => [
    'debug' => false,
    'cachingEnabled' => false,
  ],
  'dev' => [
    'debug' => true,
  ],

  // Staging environment settings
  'staging' => [
    'debug' => false,
    'cachingEnabled' => true,
  ],

  // Production environment settings
  'production' => [
    'debug' => false,
    'cachingEnabled' => true,
    'cacheControlHeader' => 'public, s-maxage=14400, max-age=0',
  ],
];
Romanavr commented 1 year ago

изображение After deleting the last 2 values and clearing the cache, I can apply the changes from the project file

bencroker commented 1 year ago

I’m not sure why applying project config changes would not have removed the warmCacheDelay setting, but glad to hear you resolved it!

kaspar-allenbach commented 1 year ago

I haven't defined warmCacheDelay in /config/blitz.php either. How exactely did you resolve this? @Romanavr

I found an entry in the project.yaml:

image

Is this the culprit? I'm afraid changing anything manually here.

bencroker commented 1 year ago

@kaspar-allenbach Removing the setting from project config, as described above, should work, let me know if you have any further issues.

kaspar-allenbach commented 1 year ago

Ah. this is indeed the project config. Okay now I get it. Thank you

Romanavr commented 1 year ago

I haven't defined warmCacheDelay in /config/blitz.php either. How exactely did you resolve this? @Romanavr

I found an entry in the project.yaml:

image

Is this the culprit? I'm afraid changing anything manually here.

I've removed it manually from the DB, projectconfig table, example on the screenshot. Ben's method didn't work for me.

kaspar-allenbach commented 1 year ago

I think I found the solution:

  1. ./craft project-config rebuild
  2. ./craft project-config/apply
  3. ./craft blitz/cache/clear

via the terminal. The Blitz CP Panel is inacessible with this issue ¯_(ツ)_/¯

johnwbaxter commented 1 year ago

@bencroker I've got this exact same issue too! Nothing in my project config mentions the warmCacheDelay setting anywhere.

[error] yii\base\UnknownPropertyException: Setting unknown property: putyourlightson\blitz\drivers\purgers\CloudflarePurger::warmCacheDelay at /var/www/html/vendor/yiisoft/yii2/base/Component.php:209

This is coming from a Craft 3.8 -> Craft 4.4 upgrade!

I can't apply my updated project config from the upgrade with this issue!

bencroker commented 1 year ago

@johnwbaxter Is the config setting found in the config/blitz.php file, perhaps?

johnwbaxter commented 1 year ago

@bencroker Nope!! I searched the whole project and it's nowhere in any config or PC.

I have resolved i?t by doing what @kaspar-allenbach suggested. rebuild/apply/clear and then redeploy the branch with the migrated PC from the repo and then run "reapply everything" and now I'm back in business.

Very weird though.

bencroker commented 1 year ago

My guess it that it was either cached or stored in the database. Glad to hear you got it resolved.