TypeError when Open Graph image does not exist
madebyherzblut opened this issue · 3 comments
madebyherzblut commented
Thanks for seomate—it is a well-built plugin! The one thing we run into quite often is a fatal type error when the og:image
file does not exist. This happens when a developer pulls a SQL dump from the live environment into their dev environment.
Is there are a way to ignore the missing file?
TypeError: Argument 1 passed to craft\helpers\UrlHelper::isAbsoluteUrl() must be of the type string, null given, called in /var/www/vendor/vaersaagod/seomate/src/helpers/SEOMateHelper.php on line 319 and defined in /var/www/vendor/craftcms/cms/src/helpers/UrlHelper.php:28
Stack trace:
#0 /var/www/vendor/vaersaagod/seomate/src/helpers/SEOMateHelper.php(319): craft\helpers\UrlHelper::isAbsoluteUrl(NULL)
#1 /var/www/vendor/vaersaagod/seomate/src/services/MetaService.php(315): vaersaagod\seomate\helpers\SEOMateHelper::ensureAbsoluteUrl(NULL)
#2 /var/www/vendor/vaersaagod/seomate/src/services/MetaService.php(234): vaersaagod\seomate\services\MetaService->getTransformedUrl(Object(craft\elements\Asset), Array, Object(vaersaagod\seomate\models\Settings))
#3 /var/www/vendor/vaersaagod/seomate/src/services/MetaService.php(86): vaersaagod\seomate\services\MetaService->transformMetaAssets(Array, Object(vaersaagod\seomate\models\Settings))
#4 /var/www/vendor/vaersaagod/seomate/src/SEOMate.php(240): vaersaagod\seomate\services\MetaService->getContextMeta(Array)
#5 /var/www/vendor/craftcms/cms/src/web/View.php(1575): vaersaagod\seomate\SEOMate->onRegisterMetaHook(Array)
#6 /var/www/storage/runtime/compiled_templates/26/265bf91e1ea2bb98300427f7afbfa78fd5119ede2332fb0a54aad9942935af5e.php(67): craft\web\View->invokeHook('seomateMeta', Array)
#7 /var/www/vendor/twig/twig/src/Template.php(407): __TwigTemplate_4dfcc93b60741ff8242b76cb1ef68ce71d72387755cfd0cc86fa36bfa9db1d94->doDisplay(Array, Array)
#8 /var/www/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#9 /var/www/storage/runtime/compiled_templates/33/334be0af66dc13a1d9e1efd3aa5e5c62308ffaf0dca0d901938e9be4adcc4705.php(45): Twig\Template->display(Array, Array)
#10 /var/www/vendor/twig/twig/src/Template.php(407): __TwigTemplate_2dd2101fad16bd4df22c76a1977e91f87bc3315e99f66c90e4cdc8c8244d2bbb->doDisplay(Array, Array)
#11 /var/www/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#12 /var/www/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#13 /var/www/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#14 /var/www/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#15 /var/www/vendor/craftcms/cms/src/web/View.php(392): Twig\Environment->render('<redacted>>/_ind...', Array)
#16 /var/www/vendor/craftcms/cms/src/web/View.php(453): craft\web\View->renderTemplate('<redacted>>/_ind...', Array)
#17 /var/www/vendor/craftcms/cms/src/web/Controller.php(251): craft\web\View->renderPageTemplate('<redacted>>/_ind...', Array, 'site')
#18 /var/www/vendor/craftcms/cms/src/controllers/TemplatesController.php(100): craft\web\Controller->renderTemplate('<redacted>>/_ind...', Array)
#19 [internal function]: craft\controllers\TemplatesController->actionRender('<redacted>>/_ind...', Array)
#20 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#21 /var/www/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#22 /var/www/vendor/craftcms/cms/src/web/Controller.php(189): yii\base\Controller->runAction('render', Array)
#23 /var/www/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('render', Array)
#24 /var/www/vendor/craftcms/cms/src/web/Application.php(285): yii\base\Module->runAction('templates/rende...', Array)
#25 /var/www/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('templates/rende...', Array)
#26 /var/www/vendor/craftcms/cms/src/web/Application.php(270): yii\web\Application->handleRequest(Object(craft\web\Request))
#27 /var/www/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#28 /var/www/web/index.php(22): yii\base\Application->run()
#29 {main}
mattbloomfield commented
Yes, seeing this as well and it's a bit frustrating. We are refing a global and when I pushed to staging the first time it happened since the image there didn't exist yet (using project config so field existed with no value).
architchandra commented
Any fix for this?
mmikkel commented
Just released SEOMate v. 1.1.8, which should resolve this issue. Thanks for reporting!