Problem/Motivation
When upgrading to Drupal 9, it is possible that the configured action for the 'update_non_existent' setting no longer exists. In this case, we want the import to fail gracefully, not with a fatal error.
Right now, the import would fail with an error like this:
The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "foo" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: commerce_publish_product, commerce_unpublish_product, entity_delete_action:commerce_product, entity_delete_action:commerce_store, feeds_feed_delete_action, node_unpromote_action, node_unpublish_action, node_publish_action, node_unpublish_by_keyword_action, node_assign_owner_action, node_promote_action, node_save_action, node_make_sticky_action, node_make_unsticky_action, node_delete_action, user_cancel_user_action, user_unblock_user_action, user_block_user_action, user_remove_role_action, user_add_role_action, action_send_email_action, entity:save_action:commerce_product_variation, entity:save_action:commerce_product, entity:save_action:commerce_product_attribute_value, entity:save_action:feeds_feed, entity:save_action:file, entity:save_action:group, entity:save_action:group_content, entity:save_action:node, entity:save_action:user, entity:unpublish_action:commerce_product_variation, entity:unpublish_action:commerce_product, entity:unpublish_action:node, entity:unpublish_action:path_alias, entity:publish_action:commerce_product_variation, entity:publish_action:commerce_product, entity:publish_action:node, entity:publish_action:path_alias, action_goto_action, action_message_action, entity:delete_action:commerce_product, entity:delete_action:commerce_store, entity:delete_action:node in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Proposed resolution
Catch and log exceptions during the Clean stage.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Patch will follow.
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds-non-existent-actions-3138185-2.patch | 5.75 KB | MegaChriz |
#2 | feeds-non-existent-actions-3138185-2-tests-only.patch | 3.77 KB | MegaChriz |
Comments
Comment #2
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThis patch catches a PluginNotFoundException in
EntityProcessorBase::clean()
. However, since the entity shouldn't be marked as cleaned, the exception is rethrown there as well. Therefore, the exception needs to be catched on layer above, which happens to be LazySubscriber.Additionally, an exception is catched as well in
EntityProcessorBase::calculateDependencies()
. This is necessary for the test to change the setting 'update_non_existent' to a non-existing action plugin called 'foo'. It is necessary for fixing one D9 test failure as well, see #3129114-12: Fix Drupal 9 test failures.Comment #4
andypostLooks in related something was not polished enough (maybe upgrade path or missing reaction on removal of action)
Comment #6
MegaChriz CreditAttribution: MegaChriz as a volunteer and at WebCoo commentedI checked again if an error message gets logged when trying to save a feed type and that was the case:
So I think it's good enough. Committed #2.
@andypost
You are correct, that other issue is directly related.