Server Error
Closed this issue · 12 comments
Hi,
This is working great for me in DevMode, but when I switch it off DevMode I am getting a Server Error..
Any help appreciated, thanks
Just a note - it's happening on 2 Craft 3 sites I am running
Is it a 500 error? Could you please share the craft error logs when the server error occurs? Then I can see where i comes from.
Could you also double check that the path {craftpath}/storage/runtime/htmcache exists?
Hi, the path does exist.
It just says "Internal Server Error Server Error". Admin CP works fine though.
Log here:
Stack trace:
#0 /home/runcloud/webapps/appname/vendor/bolden/htmlcache/src/services/HtmlcacheService.php(110): bolden\htmlcache\services\HtmlcacheService->isElementApiRoute()
#1 /home/runcloud/webapps/appname/vendor/bolden/htmlcache/src/services/HtmlcacheService.php(50): bolden\htmlcache\services\HtmlcacheService->canCreateCacheFile()
#2 /home/runcloud/webapps/appname/vendor/bolden/htmlcache/src/HtmlCache.php(126): bolden\htmlcache\services\HtmlcacheService->checkForCacheFile()
#3 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/base/BaseObject.php(109): bolden\htmlcache\HtmlCache->init()
#4 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#5 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/base/Plugin.php(113): yii\base\Module->__construct('html-cache', Object(craft\web\Application), Array)
#6 [internal function]: craft\base\Plugin->__construct('html-cache', Object(craft\web\Application), Array)
#7 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#8 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('bolden\\htmlcach...', Array, Array)
#9 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('bolden\\htmlcach...', Array, Array)
#10 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/services/Plugins.php(788): yii\BaseYii::createObject(Array, Array)
#11 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/services/Plugins.php(199): craft\services\Plugins->createPlugin('html-cache', Array)
#12 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/base/ApplicationTrait.php(1148): craft\services\Plugins->loadPlugins()
#13 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/web/Application.php(109): craft\web\Application->_postInit()
#14 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#15 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#16 /home/runcloud/webapps/appname/vendor/craftcms/cms/src/web/Application.php(97): yii\base\Application->__construct(Array)
#17 [internal function]: craft\web\Application->__construct(Array)
#18 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#19 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#20 /home/runcloud/webapps/appname/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#21 /home/runcloud/webapps/appname/vendor/craftcms/cms/bootstrap/bootstrap.php(252): yii\BaseYii::createObject(Array)
#22 /home/runcloud/webapps/appname/vendor/craftcms/cms/bootstrap/web.php(42): require('/home/runcloud/...')
#23 /home/runcloud/webapps/appname/public/index.php(20): require('/home/runcloud/...')
#24 {main}
Thanks for your help :)
What does the line above Stack trace:
say?
There should be something like Fatal error: Maximum execution time of 30 seconds exceeded in file.php on line 50
Further I see it fails at the function isElementApiRoute
. In there, element api paths are being checked with preg_match. Do you use ~
character in the element api routes maybe?
2018-09-27 09:25:26 [-][1][p70d45frlrbjngmo66c4ji4vdq][error][Error] Error: Call to a member function getSettings() on null in /home/runcloud/webapps/appname/vendor/bolden/htmlcache/src/services/HtmlcacheService.php:122
Do you use ~ character in the element api routes maybe?
Not sure I follow. Do you mean in the Routes section of the CP? If so that is empty. Thanks, any further ideas?
Are you using Element API plugin?
Hi, no i'm not..
I think that is the problem. I will check if that is the problem and I will fix. I will keep you up to date!
I have released a new version with fix for the error message. Can you check if it fixes your issue?
Thanks, no error now, how can I tell if tis working? Would you still use the native {% cache %} tags along with this plugin also? Thanks so much!
You should see files in {craftpath}/storage/runtime/htmcache/ folder. That's where cached file are stored and served. Also response times should be very low. You are welcome!