xperseguers / t3ext-cloudflare

The Cloudflare TYPO3 extension ensures your TYPO3 website is running optimally on the Cloudflare platform.
https://extensions.typo3.org/extension/cloudflare
GNU General Public License v3.0
7 stars 11 forks source link

Throws Exception when creating TSFEController in TYPO3 10 with enablePurgeByUrl #21

Closed tpinne closed 2 months ago

tpinne commented 3 years ago

Everytime I try to clear the cache for a single page or through clearCacheCmd in PageTSConfig I get the following Exception

#1561583127 InvalidArgumentException

TypoScriptFrontendController must be constructed with a valid SiteLanguage object or a resolved site in the current request as fallback. None given.

As it seems the constructor of TypoScriptFrontendController has significant changes to prior versions of TYPO3.

https://github.com/TYPO3/typo3/blob/fe16eeb92d49edc5e79041dd949bc68cf66dfdce/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php#L690-L732

Therefore the current implementation of https://github.com/xperseguers/t3ext-cloudflare/blob/8153cddbd8b8563022f3c961ace5f8ba86667220/Classes/Hooks/TCEmain.php#L178-L183 seems to need a major refactor.

At the moment I have no spontaneous idea on how to create the necessary parameters with valid options to create a working TSFE within the backend context. And it seems to be a problem multiple people have, because the search for this exception message brought plenty results. All with the base problem trying to create the TSFE in backend context. But haven't found a solution among those results yet.