post-update hook throws error for 1.10

Created on 16 January 2025, 3 months ago

I've updated Search API Autocomplete from 1.9 to 1.10. Now drush updb throws the following error:

drush updb -y
--------------- ---------------- ------------- ------------------------------
 Module           Update ID        Type          Description
---------------- ---------------- ------------- ------------------------------
 search_api_aut   sort_dependenc   post-update   Sort Search API Autocomplete
 ocomplete        ies_order                      entity dependencies.
---------------- ---------------- ------------- ------------------------------

// Do you wish to run the specified pending updates?: yes.

[notice] Update started: search_api_autocomplete_post_update_sort_dependencies_order
[error]  The datasource with ID 'entity:media' could not be retrieved for index 'Allgemeine Suche'.
[error]  Update failed: search_api_autocomplete_post_update_sort_dependencies_order
[error]  Update aborted by: search_api_autocomplete_post_update_sort_dependencies_order
[error]  Finished performing updates.

My index config does not specify 'media' as datasource, just 'content' (nodes). So why does it try to use 'entity:media'?

๐Ÿ› Bug report
Status

Active

Version

1.10

Component

General code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany drubb Sindelfingen

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

Merge Requests

Comments & Activities

  • Issue created by @drubb
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany drubb Sindelfingen

    The config for the particular index:

    uuid: 02b8eac8-e115-4dcf-992b-208c2ae7f2aa
    langcode: de
    status: true
    dependencies:
      config:
        - field.storage.node.field_content
        - field.storage.node.field_teaser
        - search_api.server.elasticsearch
      module:
        - node
    id: search
    name: 'Allgemeine Suche'
    description: ''
    read_only: false
    field_settings:
      field_content:
        label: Langfassung
        datasource_id: 'entity:node'
        property_path: field_content
        type: text
        dependencies:
          config:
            - field.storage.node.field_content
      field_teaser:
        label: Kurzfassung
        datasource_id: 'entity:node'
        property_path: field_teaser
        type: text
        dependencies:
          config:
            - field.storage.node.field_teaser
      title:
        label: Titel
        datasource_id: 'entity:node'
        property_path: title
        type: text
        boost: 2.0
        dependencies:
          module:
            - node
      type:
        label: Inhaltstyp
        datasource_id: 'entity:node'
        property_path: type
        type: string
        dependencies:
          module:
            - node
    datasource_settings:
      'entity:node':
        bundles:
          default: true
          selected:
            - blogpost
            - editorship
            - playlist
        languages:
          default: true
          selected: {  }
    processor_settings:
      add_url: {  }
      aggregated_field: {  }
      custom_value: {  }
      entity_status: {  }
      entity_type: {  }
      highlight:
        weights:
          postprocess_query: 0
        prefix: '<strong>'
        suffix: '</strong>'
        excerpt: true
        excerpt_always: true
        excerpt_length: 256
        exclude_fields:
          - title
        highlight: always
        highlight_partial: true
      html_filter:
        weights:
          preprocess_index: -15
          preprocess_query: -15
        all_fields: true
        fields:
          - field_content
          - field_teaser
          - title
          - type
        title: true
        alt: true
        tags:
          b: 2
          h1: 5
          h2: 3
          h3: 2
          strong: 2
      ignorecase:
        all_fields: true
        fields:
          - field_content
          - field_teaser
          - title
          - type
      language_with_fallback: {  }
      rendered_item: {  }
      type_boost:
        weights:
          preprocess_index: 0
        boosts:
          'entity:node':
            datasource_boost: 0.0
            bundle_boosts:
              news: 0.0
              page: 0.5
              series: 0.5
    tracker_settings:
      default:
        indexing_order: lifo
    options:
      cron_limit: 200
      index_directly: true
      track_changes_in_references: true
    server: elasticsearch
    
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States w01f

    I think we're getting the same error:

    "drush updb" gives:
    [error] Search API Autocomplete requires this module and version. Currently using
    Search API version
    (Currently using Unresolved dependency Search API (Version >= 8.x-1.20 required)
    )

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria drunken monkey Vienna, Austria

    Thanks for reporting this problem!
    Thatโ€™s really a doozy. Off the top of my head, I canโ€™t venture a guess why this would happen.
    Are you able to obtain a stack trace for the error? (It is thrown in \Drupal\search_api\Entity\Index::getDatasource().) That would help a lot.

    (In the future, however, please donโ€™t post config YAML as a comment, but instead use an attachment.)

    @w01f: That seems like an entirely different problem, namely that you have Search API installed via Git and Drupal unfortunately does not handle that correctly. It therefore incorrectly reports a dependency version conflict.

  • ๐Ÿ‡ท๐Ÿ‡ธSerbia sumi

    @drubb I have run into the similar issue, in my case it was 'node:entity' and my index didn't use node:entity.
    But when I looked at the yml file for the search_api_autocomplete for that index I saw in the yml node:entity config.
    In the UI there were no settings for the node:entity but in the yml file there was.
    Cleaning up manually yml file and removing all things related to node:entity and then importing the config resolved my issue. This needs to be done carefully and checking the dependancies, fields, view_modes basically entire file and making sure that it is correctly adjusted and that config can be imported after the changes are done.

    I presume that at some point the index also included the node:entity but when it was removed from the index search_api_autocomplete yml file was not updated to remove the rows relating to node:entity. Just looking at the UI you would not be able to see this.

    So there is a good chance that there is a different issue of search_api_autocomplete files not getting updated when related index is updated by removing one of the previously indexed entities.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ankita31

    I am also facing the same error, on update DB command:
    [error] Search API Autocomplete requires this module and version. Currently using
    Search API version
    (Currently using Unresolved dependency Search API (Version >= 1.37 required)
    )

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance bdnosp

    Hello,

    Same kind of error here (rolled back to previous module version)

    with search_api 8.x-1.37 + search_api_autocomplet 8.x-110 +search_api_solr 4.3.7 + search_api_solr_autocomplete 4.3.7

      Error Output:                                                                
      ================                                                             
      >  [notice] Update started: search_api_autocomplete_post_update_sort_depend  
      encies_order                                                                 
      >  [error]  The datasource with ID 'solr_document' could not be retrieved f  
      or index 'Main index'.                                                       
      >  [error]  Update failed: search_api_autocomplete_post_update_sort_depende  
      ncies_order                                                                  
       [error]  Update aborted by: search_api_autocomplete_post_update_sort_depen  
      dencies_order                                                                
       [error]  Finished performing updates.  

    thanks

  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires

    We also faced the same error after updating the module to the latest version. In our case the issue was related to a "entity_type.manager" key because it has a dot (".") though we couldn't anywhere find this entry in the YML files. Decided to roll back to 1.9 for now.

    In case it helps, the message returned is coming from ConfigBase::validateKeys.

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria hatsch

    I am also facing the same Error after updating to 1.10

    > [notice] Update started: search_api_autocomplete_post_update_sort_dependencies_order
    > [error] The datasource with ID 'entity:group' could not be retrieved for index 'videos'.
    > [error] Update failed: search_api_autocomplete_post_update_sort_dependencies_order
    [error] Update aborted by: search_api_autocomplete_post_update_sort_dependencies_order
    [error] Finished performing updates.
    Failed to run drush updb: exit status 1

    there is no reference to entity:group in the config file for the index and UI.
    groups are indexed via entitygroupfield:entity

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria drunken monkey Vienna, Austria

    @vensires: That doesnโ€™t sound like the same problem. Or did you get the same The datasource with ID 'X' could not be retrieved for index 'Y'. error as the others?

    A stacktrace would still be very useful, but I have a first suspect: LiveResults::calculateDependencies(), which calls $index->getDatasource() without catching the potentially occurring exception.
    Please try whether this MR resolves the problem for you.

  • ๐Ÿ‡ฆ๐Ÿ‡นAustria hatsch

    thanks drunken monkey. i can confirm the MR resolves the issue!

    sorry, i missed the point with the stacktrace. didn't see anything in the logs ( when running drush updb).
    running update.php gave this backtrace:

    #0 /var/www/html/web/modules/contrib/search_api_autocomplete/src/Plugin/search_api_autocomplete/suggester/LiveResults.php(417): Drupal\search_api\Entity\Index->getDatasource()
    #1 /var/www/html/web/modules/contrib/search_api_autocomplete/src/Entity/Search.php(689): Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\suggester\LiveResults->calculateDependencies()
    #2 /var/www/html/web/modules/contrib/search_api_autocomplete/src/Entity/Search.php(509): Drupal\search_api_autocomplete\Entity\Search->getDependencyData()
    #3 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(131): Drupal\search_api_autocomplete\Entity\Search->calculateDependencies()
    #4 [internal function]: Drupal\Core\Config\Entity\ConfigEntityUpdater->Drupal\Core\Config\Entity\{closure}()
    #5 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(190): call_user_func()
    #6 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(147): Drupal\Core\Config\Entity\ConfigEntityUpdater->doOne()
    #7 /var/www/html/web/modules/contrib/search_api_autocomplete/search_api_autocomplete.post_update.php(15): Drupal\Core\Config\Entity\ConfigEntityUpdater->update()
    #8 /var/www/html/web/core/includes/update.inc(243): search_api_autocomplete_post_update_sort_dependencies_order()
    #9 /var/www/html/web/core/includes/batch.inc(297): update_invoke_post_update()
    #10 /var/www/html/web/core/includes/batch.inc(139): _batch_process()
    #11 /var/www/html/web/core/includes/batch.inc(95): _batch_do()
    #12 /var/www/html/web/core/modules/system/src/Controller/DbUpdateController.php(195): _batch_page()
    #13 [internal function]: Drupal\system\Controller\DbUpdateController->handle()
    #14 /var/www/html/web/core/lib/Drupal/Core/Update/UpdateKernel.php(115): call_user_func_array()
    #15 /var/www/html/web/core/lib/Drupal/Core/Update/UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw()
    #16 /var/www/html/web/update.php(27): Drupal\Core\Update\UpdateKernel->handle()
    #17 {main}
  • ๐Ÿ‡ฆ๐Ÿ‡นAustria hatsch
  • Pipeline finished with Skipped
    about 1 month ago
    #431844
  • ๐Ÿ‡ฆ๐Ÿ‡นAustria drunken monkey Vienna, Austria

    Good to hear, thanks a lot for testing and reporting back.
    Merged.

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

Production build 0.71.5 2024