2

I've updated to Drupal 11.1.2 from Drupal 10 but when I try importing configs I get this error.

TypeError: Cannot assign null to property Drupal\tour\Entity\Tour::$module of type string in Drupal\Core\Entity\EntityBase->__construct() (line 63 of /var/www/web/core/lib/Drupal/Core/Entity/EntityBase.php) #0 /var/www/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php (112): Drupal\Core\Entity\EntityBase->__construct()

I've run drush eval "\$module_data = \Drupal::config('core.extension')->get('module'); unset(\$module_data['tour']); \Drupal::configFactory()->getEditable('core.extension')->set('module', \$module_data)->save();" to remove tour from the database but it didn't seem to help.

1
  • 1
    Never do a major version upgrade like from Drupal 10 to 11 on a prod server without preparation and testing. You can use Upgrade Status to find deprecated code or at least check for deprecated modules on the Extend page. Test the upgrade on a copy of the site and make backups, so that you can start over and remove the deprecated code dependency before upgrading. Commented Jul 4 at 6:30

1 Answer 1

1

It's really not a good idea to try to remove a module this way, the system needs the opportunity to clean up after it, and the module itself may have tasks that run on uninstall which you're bypassing by going straight into one of the related config files.

The simplest way to recover is to restore a backup, composer require drupal/tour (the contrib Tour module), uninstall it properly (drush pmu or through the UI), then composer remove drupal/tour.

Depending on your workflows this may take 2 deployments to fix upstream, one to restore the tour module code and uninstall the module, and one to remove the tour module from composer again.

To avoid this sort of thing in future, just make sure the module has been uninstalled/replaced before the major Drupal version upgrade.

5
  • I've added the tour module back in and still encounter the same error Commented Jul 2 at 16:41
  • Did you restore a database backup first? Commented Jul 2 at 17:12
  • yes i have restored from a previous database backup and still get this error Commented Jul 2 at 20:13
  • Assuming the backup was from before you did the upgrade, rebuilding cache first should sort it. It's difficult to say without being in front of it to be honest. 4k4's advice in the comment above is probably better than this answer if you're struggling - restore to a known good version, i.e. copy down db/files from prod (or restore from known-good backup if that's not an option), restore the codebase to the Drupal 10 version, then upgrade to the very latest D10 (10.5.1 at time of writing), run updates, then uninstall the tour module, confirm everything's working, then start the D11 upgrade Commented Jul 4 at 18:12
  • Actually if you're not already at 10.5.1, you should upgrade to that first and push upstream. The advice is always to upgrade from the latest previous major version and this may help to avoid further difficulties Commented Jul 4 at 18:16

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.