Cannot upgrade from 2.0.3 to 3.0.9

Created on 1 May 2025, 2 months ago

Problem/Motivation

After using Composer to upgrade from version 2.0.3 to 3.0.9, BasicShib does not appear to be fully upgraded. The status report page shows that there are 3 "Mismatched entity and/or field definitions":

Entity/field definitions
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Policies
The Policies entity type needs to be installed.
basicshiblog
The basicshiblog entity type needs to be installed.
authorization
The authorization entity type needs to be installed.

After this, BasicShib can't be uninstalled. Going to the "Extend > Uninstall module" page or running drush pmu basicshib produces the following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'basicshiblog' doesn't exist

Steps to reproduce

  1. Install and enable basicshib 2.0.3
  2. Upgrade to version 3 via Composer: composer require "drupal/basicshib:^3"
  3. Go to "Reports > Status report" and see "Mismatched entity and/or field definitions" error.
  4. Go to "Extend > Uninstall module" and see "Base table or view not found" fatal error.

Note that installing version 3 directly (not upgrading) does work correctly.

Proposed resolution

Users should be able to upgrade from version 2 to version 3.

A hook_update_n() is required to install the missing entities that are new to version 3.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jrb
  • πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

    I was able to create a hook_update_n() function to add the missing entities, but we're now getting this error when the user is redirected back to the site:

    https://example.edu/basicshib/login?after_login=/home

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\basicshib\Plugin\BasicShibPluginManager are: grouper_default in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

  • πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

    With this change, we were able to upgrade to the 3.0 version.

  • πŸ‡ΊπŸ‡ΈUnited States athrylith

    Several updates and fixes have been added, that should resolve the upgrading from versions 2 to 3. If you are still experiencing problems or have any feature requests please let us know.

  • πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

    Upgrading from 2.0.3 to 3.0.11 still does not work for the same reason.

    The existing upgrade process does not install those new entities. This can be done by adding a new hook_update_n() per the MR:

    https://git.drupalcode.org/project/basicshib/-/merge_requests/13/diffs

  • Thanks, jrb for noting this and providing an interim solution!

    I can confirm that upgrading from 2.0.3 to 3.0.11 does not work properly, just as you noted, and your MR (MR!13) resolves the issue perfectly.

    Thanks again!

  • An addendum to my previous comment, as I seem to have spoken a bit prematurely.

    The additional update hook in MR!13 does indeed allow you to update basicshib from 2.x to 3.x, and subsequently access features like the Extend->Uninstall admin page, but in our installation(s), the actual Shib login process would not complete properly.

    When we logged in using basicshib's Shib login link, we could authenticate to the shib provider, but the basicshib module failed to pass the login forward, resulting in a 503 screen on the front-end, and two dblog error messages in the admin UI. One of the dblog messages was identical to what @jrb reported (and then struckthrough) in comment #2:

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" plugin does not exist. Valid plugin IDs for Drupal\basicshib\Plugin\BasicShibPluginManager are: grouper_default in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

    ...and the other was a PHP Warning:

    Warning: Undefined array key "grouper" in Drupal\basicshib\AuthorizationHandler->__construct() (line 70 of modules/contrib/basicshib/src/AuthorizationHandler.php)

    I tried to downgrade the basicshib module to 2.0.3 (and reverting the schema version to 8000) and then upgrade again to 3.0.11, applying the updatedb updates, and also toggling on and off the grouper-enabled option in the config UI, but nothing seemed to fix those errors.

    The only solution I could find was to manually insert in config/sync/basicshib.settings.yml the following line in the "plugins" section (taken from basicshib/config/install/basicshib.settings.yml):

    grouper: grouper_default

    Once that entry was imported into Drupal's config, I was able to Shib-authenticate properly using the basicshib module.

    It seems as if the update-hook that updates the auth-filters is missing the ability to add the grouper_default grouper plugin as well?

    Also, and this may not be important, but I also noticed that the post-update-hook config/sync/basicshib.settings.yml config had the following entry:

    shibboleth_enabled: null

    ... but the basicshib/config/install/basicshib.settings.yml config file has this entry as:

    shibboleth_default_login:
      shibboleth_enabled: false

    I chose to replace the former entry with the latter entry in our config, but I didn't see any difference on the installation.

Production build 0.71.5 2024