After creating a new storeview for a new website/store I have problems indexing Catalog Rule Product (catalogrule_rule) via crontab. As a consequence also the other indexes following this index are not processed.
Cron.log:
[2020-08-04 12:51:04] main.CRITICAL: Indexing Catalog Rule Product failed. For details see exception-log. {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): Indexing Catalog Rule Product failed. For details see exception-log. at application/vendor/magento/module-catalog-rule/Model/Indexer/IndexBuilder.php:299)"} []
Exception.log:
[2020-08-04 12:50:04] main.CRITICAL: DateTimeZone::__construct(): Unknown or bad timezone () {"exception":"[object] (Exception(code: 0): DateTimeZone::__construct(): Unknown or bad timezone () at application/vendor/magento/framework/Stdlib/DateTime/Timezone.php:199)"} []
Any idea what is causing the exception ??
BTW: when I reindex via CLI using bin/magento indexer:reindex the problem is gone and all indexes are indexed without problems. However when the index gets invalidated the problem is there again.
Solved! Go to Solution.
An additional bin/magento setup:upgrade did the trick
Hello @rickert
Login to the admin panel.
Go to Admin > Store > Configuration > General > Locale Options
Check if the timezone is set properly and also check the same store wise.
Thank you.
Thank you for your help. I'm afraid it's not that simple. The timezone is set to Middle European Time (Europe/Amsterdam) on Standard config level only. I have 3 websites W1, W2 and W3 each website has 1 store and each store has 1 storefront. Website number 3 was added just recently and things go bad after adding the storefront for W3.
I can see that indexing catalogrule_rule triggers ScopeDate() in Timezone.php for all 3 stores:
$timezone = new \DateTimeZone($this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope));
So subsequently
$timezone = new \DateTimeZone('general/locale/timezone', 'store', 1));
$timezone = new \DateTimeZone('general/locale/timezone', 'store', 2));
$timezone = new \DateTimeZone('general/locale/timezone', 'store', 3));
is executed. The 3rd time (for store 3) causes the exception.
I don't have a clue. I deleted and added the 3rd website a hundred times and also reinstalled the database a couple of times. But this did not help in any way. If I remove the 3rd website (and store and storefront) the problem is gone.
I also tried explicitely setting the timezone for W3 on website level but this did not help either.
Any help much appreciated.