1

I've got a newly upgraded Craft 3 site. I have one section with a few entry types. However, when attempting to switch to a different entry type I get a JS error:

Failed to load resource: the server responded with a status of 500 () https://domain.com/index.php?p=admin/actions/entries/switch-entry-type

I've verified the site url and each field in the entry types.

From the yii debugger:

 TypeError: Argument 1 passed to craft\services\Elements::getElementById() must be of the type integer, string given, called in /home/xxxx/craft3/vendor/barrelstrength/sprout-seo/src/fields/ElementMetadata.php on line 189 and defined in /home/xxxx/craft3/vendor/craftcms/cms/src/services/Elements.php:174
Stack trace:
#0 /home/xxxx/craft3/vendor/barrelstrength/sprout-seo/src/fields/ElementMetadata.php(189): craft\services\Elements->getElementById('')
#1 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Extension/Core.php(1619): barrelstrength\sproutseo\fields\ElementMetadata->getInputHtml(Object(barrelstrength\sproutseo\models\Metadata), Object(craft\elements\Entry))
#2 /home/xxxx/craft3/vendor/craftcms/cms/src/helpers/Template.php(73): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(barrelstrength\sproutseo\fields\ElementMetadata), 'getInputHtml', Array, 'method', false, false)
#3 /home/xxxx/craft3/storage/runtime/compiled_templates/46/46a7b66548802d89cb6e5e9120dba7ea1ad7665705cd35d5875d2f2159ea89b8.php(83): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(barrelstrength\sproutseo\fields\ElementMetadata), 'getInputHtml', Array, 'method')
#4 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_95cfe8b626753c0b28835c72443139945f42ded55602d1a15240c5a71d272740->doDisplay(Array, Array)
#5 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#6 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#7 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#8 /home/xxxx/craft3/storage/runtime/compiled_templates/ad/ad67eeee9d6a0c49d9fa00e4e63b57f23e8aa6d49bc3e39ca25b08dce15d23f5.php(47): craft\web\twig\Template->display(Array)
#9 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_81ae65a6f8373ba5cf70bf8aca79f49038baa5a381623bc7b797f2a894a29a1a->doDisplay(Array, Array)
#10 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#11 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#12 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#13 /home/xxxx/craft3/storage/runtime/compiled_templates/79/79255023f7a23e8fe6f99b0179ae2940e4618e223d8ec3ad853784cf76bfb479.php(59): craft\web\twig\Template->display(Array)
#14 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(390): __TwigTemplate_01b4e3e362dd97c023ddf1eecf2e1a873239f75ff1449d71ff06d570334500da->doDisplay(Array, Array)
#15 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(49): Twig_Template->displayWithErrorHandling(Array, Array)
#16 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(367): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#17 /home/xxxx/craft3/vendor/craftcms/cms/src/web/twig/Template.php(31): Twig_Template->display(Array, Array)
#18 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Template.php(375): craft\web\twig\Template->display(Array)
#19 /home/xxxx/craft3/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template->render(Array)
#20 /home/xxxx/craft3/vendor/craftcms/cms/src/web/View.php(331): Twig_Environment->render('entries/_fields', Array)
#21 /home/xxxx/craft3/vendor/craftcms/cms/src/controllers/EntriesController.php(406): craft\web\View->renderTemplate('entries/_fields', Array)
#22 [internal function]: craft\controllers\EntriesController->actionSwitchEntryType()
#23 /home/xxxx/craft3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#24 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#25 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Controller.php(104): yii\base\Controller->runAction('switch-entry-ty...', Array)
#26 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('switch-entry-ty...', Array)
#27 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module->runAction('entries/switch-...', Array)
#28 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(542): craft\web\Application->runAction('entries/switch-...', Array)
#29 /home/xxxx/craft3/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#30 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#31 /home/xxxx/dev.xxxx/index.php(23): yii\base\Application->run()
#32 {main}
  • Would you mind sharing the stack trace of the error? – Robin Schambach Oct 22 '18 at 17:28
  • Not sure if this is what you were looking for: Unchecked runtime.lastError: The message port closed before a response was received. jquery.js:9566 POST xxxxx.com/index.php?p=admin/actions/entries/switch-entry-type 500 send @ jquery.js:9566 ajax @ jquery.js:9173 postActionRequest @ Craft.js:352 onTypeChange @ EntryTypeSwitcher.js:19 i @ jquery.js:496 (anonymous) @ garnish.js:893 i @ jquery.js:496 dispatch @ jquery.js:5206 v.handle @ jquery.js:5014 – glider Oct 22 '18 at 18:56
  • No I mean the red record in your yii2 debug toolbar with a error label, that shows what gone wrong. It lists the exact file and line of the error – Robin Schambach Oct 22 '18 at 18:58
  • Figured out how to enable that toolbar but it's not showing any errors when I get this error. It shows 201 items as grey but none red. I also checked the Log Messages in the toolbar and nothing shows up under Error or Warning. – glider Oct 22 '18 at 19:04
  • You need to fully open it in order to see every request and not just the current one. An alternative way is to open your logs in your storage folder – Robin Schambach Oct 22 '18 at 19:08
1

This was a bug and has been resolved in Sprout SEO v4.0.0-beta.10. You can update via the Plugin Store.

| improve this answer | |
  • When I try to update to the latest version from the plugin store I get an error: Composer output: Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for barrelstrength/sprout-seo 4.0.0-beta.10 -> satisfiable by barrelstrength/sprout-seo[4.0.0-beta.10]. - barrelstrength/sprout-seo 4.0.0-beta.10 requires barrelstrength/sprout-base ^3.0.10 -> no matching package found. – glider Oct 29 '18 at 22:12
  • Hey David. Sorry for the trouble. Sometimes our releases take a few hours to get picked up by the Plugin Store. This shouldn't be the norm, but please try again in a few hours. I've reached out to P&T to try to get it resolved. – Ben Parizek Oct 29 '18 at 22:36
  • @David Should be working now. – Ben Parizek Oct 29 '18 at 22:54
  • I tried updating but got a new error: Response: <pre>Exception &#039;Error&#039; with message &#039;Class &#039;barrelstrength\sproutbase\app\import\services\Themes&#039; not found&#039; in /home/xxxx/craft3/vendor/barrelstrength/sprout-forms/src/SproutForms.php:198 Stack trace: #0 /home/xxxx/craft3/vendor/yiisoft/yii2/base/BaseObject.php(109): barrelstrength\sproutforms\SproutForms-&gt;init() #1 /home/xxxx/craft3/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject-&gt;__construct(Array) .... – glider Oct 29 '18 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.