Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed entity error on upgrade #12

Open
MegaphoneJon opened this issue May 30, 2022 · 7 comments
Open

Managed entity error on upgrade #12

MegaphoneJon opened this issue May 30, 2022 · 7 comments

Comments

@MegaphoneJon
Copy link
Contributor

Hi Coleman,

You asked for this backtrace. This error seems to be happening on every subsequent extension upgrade - this actually happened when I tried updating Data Processor w/ recentmenu 1.5 installed.

Error: API Call Failed: Array
(
    [entity] => Extension
    [action] => download
    [params] => Array
        (
            [key] => dataprocessor
            [url] => https://lab.civicrm.org/extensions/dataprocessor/-/archive/1.48/dataprocessor-1.48.zip
            [install] => 
            [debug] => 1
            [version] => 3
        )

    [result] => Array
        (
            [error_code] => 0
            [entity] => Extension
            [action] => download
            [trace] => #0 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/Api4/Provider/ActionObjectProvider.php(69): Civi\Api4\Generic\AbstractUpdateAction->_run(Object(Civi\Api4\Generic\Result))
#1 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\Api4\Provider\ActionObjectProvider->invoke(Object(Civi\Api4\Generic\DAOUpdateAction))
#2 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/Api4/Generic/AbstractAction.php(234): Civi\API\Kernel->runRequest(Object(Civi\Api4\Generic\DAOUpdateAction))
#3 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/api/api.php(85): Civi\Api4\Generic\AbstractAction->execute()
#4 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Core/ManagedEntities.php(391): civicrm_api4('Navigation', 'update', Array)
#5 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Core/ManagedEntities.php(187): CRM_Core_ManagedEntities->updateExistingEntity(Object(CRM_Core_DAO_Managed), Array)
#6 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Core/ManagedEntities.php(167): CRM_Core_ManagedEntities->reconcileEnabledModule('org.civicrm.rec...')
#7 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Core/ManagedEntities.php(128): CRM_Core_ManagedEntities->reconcileEnabledModules()
#8 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(413): CRM_Core_ManagedEntities->reconcile()
#9 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Extension/Manager.php(228): CRM_Core_Invoke::rebuildMenuAndCaches(true)
#10 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/CRM/Extension/Downloader.php(143): CRM_Extension_Manager->replace('/tmp/tmp-00YcFr...')
#11 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/api/v3/Extension.php(239): CRM_Extension_Downloader->download('dataprocessor', 'https://lab.civ...')
#12 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_extension_download(Array)
#13 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#14 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest(Array)
#15 /home/jon/local/arteffect/vendor/civicrm/civicrm-core/api/api.php(22): Civi\API\Kernel->runSafe('Extension', 'download', Array)
#16 /usr/local/bin/cvsrc/src/Command/BaseCommand.php(63): civicrm_api('Extension', 'download', Array)
#17 /usr/local/bin/cvsrc/src/Command/ExtensionDownloadCommand.php(141): Civi\Cv\Command\BaseCommand->callApiSuccess(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), 'Extension', 'download', Array)
#18 /usr/local/bin/cvsrc/vendor/symfony/console/Command/Command.php(255): Civi\Cv\Command\ExtensionDownloadCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /usr/local/bin/cvsrc/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /usr/local/bin/cvsrc/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Civi\Cv\Command\ExtensionDownloadCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /usr/local/bin/cvsrc/src/Application.php(59): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /usr/local/bin/cvsrc/vendor/symfony/console/Application.php(149): Civi\Cv\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /usr/local/bin/cvsrc/src/Application.php(26): Symfony\Component\Console\Application->run()
#24 /usr/local/bin/cvsrc/bin/cv(28): Civi\Cv\Application::main('/usr/local/bin/...')
#25 {main}
            [is_error] => 1
            [error_message] => Parameter "where" is required unless primary keys are supplied in values.
        )

)
@colemanw
Copy link
Member

@MegaphoneJon it looks like this is originating from the Managed BAO attempting to update the menu item provided by this extension (in Navigation_recent_items.mgd.php). I wonder why it can't find an id. Can you try looking up the managed record? You can use the api explorer to do Managed::get where name = 'Navigation_recent_items'.

@colemanw
Copy link
Member

colemanw commented Jun 1, 2022

@MegaphoneJon are you by any chance using multisite? Because #13 could maybe (maybe) explain the bug you're seeing.

@MegaphoneJon
Copy link
Contributor Author

I don't recall all the sites I saw this on, but one of them was a multisite, yes.

@colemanw
Copy link
Member

colemanw commented Jun 2, 2022

This was on multiple sites??
@MegaphoneJon it would be really helpful if you could take a look in the civicrm_managed table to see what's going on. According to the backtrace above, it is attempting to update the navigation menu item, yet does not have an ID for it. So is there a navigation item in there and does it have an ID?

@MegaphoneJon
Copy link
Contributor Author

Hey Coleman - I checked my Ansible logs, looks like this happened on 3 of 4 sites that had this extension, and the fourth got handled slightly differently.

Here is the relevant civicrm_managed record from one of the sites.

select * from civicrm_managed WHERE module = 'org.civicrm.recentmenu';
+-----+------------------------+-------------------------+-------------+-----------+---------+----------------------+
| id  | module                 | name                    | entity_type | entity_id | cleanup | entity_modified_date |
+-----+------------------------+-------------------------+-------------+-----------+---------+----------------------+
| 116 | org.civicrm.recentmenu | Navigation_recent_items | Navigation  |       273 | always  | NULL                 |
+-----+------------------------+-------------------------+-------------+-----------+---------+----------------------+
1 row in set (0.000 sec)

@colemanw
Copy link
Member

colemanw commented Jun 2, 2022

Thanks @MegaphoneJon - it's still got me scratching my head because that record looks perfectly fine. The id is there, so why would it not be passed to the Update action? Mysterious.

@artfulrobot
Copy link

I have experienced the upgrade crash on several sites now. uninstall » install seems not to give any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants