Closed Orgoth closed 1 year ago
I am getting the same error trying to get an article with the api and postman. I am using Helix Ultimate 2.0.11 and can not find anything else besides your post here about the (Error loading menu: api) when using Joomla 4 api. Do you think this is the same issue? Thanks!
@RagdollOp
That's very possible, I just stumbled across your post on Joomshaper as well.
Important, if the support tells you that they will make an update very soon, that usually means that it will take months.
Getting back to your problem. Would you please enable the debug mode? Then trigger the problem again and please copy the stacktrace of the message. Then I should be able to tell where exactly the problem is and how you can temporarily fix it until Joomshaper makes an update.
So I narrowed it down to an issue with EasyBlog. Once I disabled the EasyBlogUsers plugin I no longer got the "Error loading menu: api". I do get another error though but it is no longer related to EasyBlog. I plan to contact their support to let them know of the issue.
`error Uncaught Throwable of type InvalidArgumentException thrown with message "Error loading menu: api". Stack trace: #0 [ROOT]/libraries/src/Application/CMSApplication.php(519): Joomla\CMS\Menu\MenuFactory->createMenu()
From this Stack trace you provided, I can see, the problem is still related to easyblog.
#2 [ROOT]/plugins/user/easyblogusers/easyblogusers.php(31): EB::config()
If I remember right, this error happens, if an extension delivers wrong parameters to Joomla.
I do not own EasyBlog so I can only give a direction.
Within the "easyblogusers.php(31): EB::config()" there should be a similar query, like the one from joomshaper/helix3.
Can you possibly provide an excerpt from this section?
From line 31, 5 lines up and down.
@Orgoth This issue will be fixed in the next update which will be released within a few days. Thanks for your patience.
Hi I found this as I am starting to use the API experimentally. I am using a rockettheme which uses gantry under the hood. So any help in getting a handle on a fix would be good thank you.
Bug description
helix3.php calls menu when client is api and throws an exception
https://github.com/JoomShaper/Helix3/blob/e4b01f37d2f2f09ed507b54a0bcf1e91ef68226b/plugins/system/helix3/helix3.php#L60
https://github.com/JoomShaper/Helix3/blob/e4b01f37d2f2f09ed507b54a0bcf1e91ef68226b/plugins/system/helix3/helix3.php#L62
Steps to reproduce
https://docs.joomla.org/J4.x:Joomla_Core_APIs#Get_Single_Article
https://docs.joomla.org/J4.x:Joomla_Core_APIs#Useful_Resources
{ "errors": [ { "code": 500, "title": "Internal server error", "detail": "InvalidArgumentException: Error loading menu: api in /libraries/src/Menu/MenuFactory.php:40\nStack trace:\n#0 /libraries/src/Menu/AbstractMenu.php(124): Joomla\CMS\Menu\MenuFactory->createMenu()\n#1 /libraries/src/Application/CMSApplication.php(518): Joomla\CMS\Menu\AbstractMenu::getInstance()\n#2 /plugins/system/helix3/helix3.php(62): Joomla\CMS\Application\CMSApplication->getMenu()\n#3 /libraries/src/Plugin/CMSPlugin.php(285): plgSystemHelix3->onAfterDispatch()\n#4 /libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()\n#5 /libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch()\n#6 /libraries/src/Application/ApiApplication.php(428): Joomla\CMS\Application\WebApplication->triggerEvent()\n#7 /libraries/src/Application/ApiApplication.php(110): Joomla\CMS\Application\ApiApplication->dispatch()\n#8 /libraries/src/Application/CMSApplication.php(278): Joomla\CMS\Application\ApiApplication->doExecute()\n#9 /api/includes/app.php(54): Joomla\CMS\Application\CMSApplication->execute()\n#10 /api/index.php(31): require_once('...')\n#11 {main}" } ] }
Expected behavior
No error exception should be thrown.
Environment
Solution
add !JFactory::getApplication()->isClient('api') to prevent the error when the api is called, which does not use the template and only returns json.
replace
if( !JFactory::getApplication()->isClient('administrator') )
withif( !JFactory::getApplication()->isClient('api') && !JFactory::getApplication()->isClient('administrator') )