Appsearch Configs Get Imported Out of Order

Created on 21 May 2024, 7 months ago
Updated 29 May 2024, 7 months ago

Problem/Motivation

When importing App search configs the following PHP error:

Error: Call to a member function getEngine() on null in Drupal\appsearch\Entity\Engine->preSave() (line 284 of /app/web/modules/contrib/elastic_enterprise_search/modules/appsearch/src/Entity/Engine.php)

The config order it is trying to import is:

lando drush cim
+------------+-----------------------------------------------------+-----------+
| Collection | Config | Operation |
+------------+-----------------------------------------------------+-----------+
| | appsearch.appsearch_engine.baltimorecity | Create |
| | appsearch.appsearch_searchui.testsearchui | Create

However, If I do the following:

1) remove the engine config from the project.
2) import the server Appseach config with drush cim
3) Replace the engine config file back into the config/sync folder
4) Import Engine configs
5) config import success, clear cache

This step works on my Drupal install (D10.2.6)

Steps to reproduce

On a d10 site Try to import Elastic Appsearch configs via drush

If the configs are in the order of Engine, then Server there should be a similar error response.

Proposed resolution

Changing the order in which the configs are imported so that it is Server before engine

πŸ› Bug report
Status

Active

Version

2.4

Component

Code

Created by

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

Comments & Activities

  • Issue created by @BaltCitySophi
  • πŸ‡ΊπŸ‡ΈUnited States dysproseum

    I originally thought it would take multiple steps to deploy this as stated. However, I was able to get this to import successfully in one "drush cim" by adding dependencies to the appsearch config files.

    The appsearch.appsearch_engine will be dependent on the server:

    - dependencies: {  }
    + dependencies:
    + config:
    +    - appsearch.appsearch_server.baltimorecity

    And the appsearch.appsearch_searchui and appsearch.engineschema will be dependent on the engine:

    - dependencies: {  }
    + dependencies:
    + config:
    +    - appsearch.appsearch_engine.baltimorecity
Production build 0.71.5 2024