Problem/Motivation

The SchedulerManager::entityRevert method seem to expect that the entity type has a bundle class.

For me all config imports are failing with The "" entity type does not exist.. While debugging I found that it's related to the entityRevert method in the scheduler module, that in my case tries to revert the entity type mailchimp_campaign. This entity type has no bundles (and no bundle class).

Therefore it's passing NULL in the following code snippet https://git.drupalcode.org/project/scheduler/-/blob/2.x/src/SchedulerMan...

foreach ($this->entityTypeManager->getStorage($bundleType)->loadMultiple() as $bundle) {

This leads to the exception.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork scheduler-3373860

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

szeidler created an issue. See original summary.

szeidler’s picture

Status: Active » Needs review
StatusFileSize
new584 bytes

Here's a workaround for the issue that just skips all entity types that do not have bundles.

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

jonathan1055’s picture

Thanks for reporting this szeidler, and for doing the debugging and providing the precise cause. Just for my info, did you find this problem when upgrading to Scheduler 2.0.0 from 8.x-1.n or have you upgraded from an earlier 2.x version?

szeidler’s picture

The sites affected, have been based upon Thunder, so went the whole way from 8.x-1.x to 2.0.0

jonathan1055’s picture

Thanks. This was added the most recent commit before 2.0.0 on #3336108: Don't run hook_modules_installed during config install
I'd be happy to commit this, and then release 2.0.1 as it seems quite a major error.

szeidler’s picture

I just noticed that it actually is influenced by another pending entity update. So in my use-case there was a pending entity update on that mailchimp_campaign entity type (which has no bundles) and since in Scheduler we retrieve all pending entity updates

$entityUpdateManager = \Drupal::entityDefinitionUpdateManager();
$changeList = $entityUpdateManager->getChangeList();

it leads to the error. Means the problem happens

  • On configuration import
  • If an entity type without bundles has pending entity updates

Since database updates should always run before doing a drush config:import, the problem only occurs if something with the entity update (caused by another module or custom code) went wrong and the error we see here is a side-effect of it.

jonathan1055’s picture

Thanks. This entityRevert function should not have been called during config import, that was an error and I have have removed it in the second commit. The only other places this function is callled are
(a) via a specific hook update where the parameter of 'paragraph' is passed, which means any other entity with a pending change will be ignored
(b) In scheduler's own hook_uninstall() ie when Scheduler is being uninstalled
(c) via drush scheduler:entity-revert

If you are happy with the change, and it fixes your problem, can you mark this RTBC, then I will commit and release 2.0.1

szeidler’s picture

Status: Needs review » Reviewed & tested by the community

From my side this looks good. Disclaimer: I haven't followed why it was introduced in the first place.

Even though my issue occurs only, if something else is off (in my case missing/wrong entity updates). This fix will not block any config import in such a scenario. That's good.

  • jonathan1055 committed 8122d8d1 on 2.x
    Issue #3373860 by szeidler: entityRevert() breaks config:import for...
jonathan1055’s picture

Status: Reviewed & tested by the community » Fixed

Disclaimer: I haven't followed why it was introduced in the first place.

I raised the question in #3336108-12: Don't run hook_modules_installed during config install and thought it was wrong to add it during the altered import steps, as it was not part of the original import process. I should have stuck to my hunch and removed it before committing.

Thanks for RTBC. Merged and fixed.

jonathan1055’s picture

I have now released Scheduler 2.0.1

Status: Fixed » Closed (fixed)

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