Problem/Motivation

The Service "user.private_tempstore" is deprecated for Drupal 9.x and must be replaced with the new Service "tempstore.private".

Steps to reproduce

Use Drupal core 9.x, enable the module and will see a php error

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "user.private_tempstore". in Drupal\Component\DependencyInjection\Container->get() (line 151 of /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php).

Proposed resolution

Replace deprecated Service.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

TheodorosPloumis created an issue. See original summary.

theodorosploumis’s picture

Issue summary: View changes
StatusFileSize
new1.08 KB
ankithashetty’s picture

Status: Needs review » Needs work

The error stated in the Issue Summary does exist. But after applying the patch in #2, I got a different error.

The website encountered an unexpected error. Please try again later.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "user.tempstore.private". Did you mean this: "tempstore.private"? in Drupal\Component\DependencyInjection\Container->get() (line 151 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Looks like the patch has provided a different service, it needs to be replaced with tempstore.private
+ $container->get('user.tempstore.private'),

Thanks.

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new1.05 KB
new870 bytes
new8.74 KB

Here is the updated patch, please review. The module installed successfully after the patch.

Thanks

vodde83’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Module does indeed install cleanly after the patch!

grimreaper’s picture

Assigned: Unassigned » grimreaper
Status: Reviewed & tested by the community » Needs work

Hello,

https://www.drupal.org/node/2935639

The PHPDoc had not been updated.

I will update the patch and create a MR.

grimreaper’s picture

As the development versions are not published on this module, impossible to reference it in the "version" field of the issue and so provided commands for fork and MR workflow are not complete.

grimreaper’s picture

Title: Replace deprecated service "user.private_tempstore" » Fix deprecated service

Also found out that the entity.manager service was used while it is also deprecated.

grimreaper’s picture

Title: Fix deprecated service » Fix deprecated services
Assigned: grimreaper » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.37 KB

MR created ans here is a patch from the MR.

z3cka’s picture

MR !2 needs a rebase for some views stuff; also, patch from #10 solved this issue for me. Any chance this could make it into an official D9 release? ...especially as D8 is now at its end of life.

andeersg’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch in #10 and it worked.

My database update crashed because of the missing service, and with the patch the updates applies without problems.

juburin’s picture

After installing the patch I get the following error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "comment_publish_action" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: broken_link_delete_action, comment_unpublish_by_keyword_action, node_set_sub_type_video_action, node_set_sub_type_article_action, node_set_sub_type_rich_media_action, node_assign_owner_action, node_unpromote_action, node_promote_action, node_make_sticky_action, node_unpublish_by_keyword_action, node_make_unsticky_action, redirect_delete_action, user_add_role_action, user_block_user_action, user_cancel_user_action, user_remove_role_action, user_unblock_user_action, webform_archive_action, webform_close_action, webform_delete_action, webform_open_action, webform_unarchive_action, webform_submission_delete_action, webform_submission_make_lock_action, webform_submission_make_sticky_action, webform_submission_make_unlock_action, webform_submission_make_unsticky_action, pathauto_update_alias, entity:delete_action:comment, entity:delete_action:media, entity:delete_action:node, entity:delete_action:webform, action_send_email_action, action_goto_action, action_message_action, entity:publish_action:block_content, entity:publish_action:comment, entity:publish_action:media, entity:publish_action:node, entity:publish_action:path_alias, entity:publish_action:taxonomy_term, entity:publish_action:menu_link_content, entity:publish_action:paragraph, entity:save_action:block_content, entity:save_action:comment, entity:save_action:file, entity:save_action:media, entity:save_action:node, entity:save_action:taxonomy_term, entity:save_action:user, entity:save_action:menu_link_content, entity:unpublish_action:block_content, entity:unpublish_action:comment, entity:unpublish_action:media, entity:unpublish_action:node, entity:unpublish_action:path_alias, entity:unpublish_action:taxonomy_term, entity:unpublish_action:menu_link_content, entity:unpublish_action:paragraph in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

juburin’s picture

Status: Reviewed & tested by the community » Needs review
hanoii’s picture

Status: Needs review » Reviewed & tested by the community

@Juburin, I am 95% sure that the error is completely unrelated to this patch. I also had to update those actions manually for the upgrade to work, but not related to the patch in this issue.

Unrelated, but


drush -y cset system.action.node_delete_action plugin entity:delete_action:node
drush -y cset system.action.media_unpublish_action plugin entity:unpublish_action:media
drush -y cset system.action.media_save_action plugin entity:save_action:media
drush -y cset system.action.media_publish_action plugin entity:publish_action:media
drush -y cset system.action.media_delete_action plugin entity:delete_action:media
drush -y cset system.action.comment_delete_action plugin entity:delete_action:comment

should help you with that.

mahaveer003 made their first commit to this issue’s fork.

mahaveer003’s picture

Version: 8.x-3.1 » 8.x-3.2
Status: Reviewed & tested by the community » Fixed

Merged and Release

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.