Problem/Motivation

When Acquia Connector and Acquia Search are installed at the same time, acquia_search_install() executes before Acquia Connector has been installed. As a result, the Acquia Connector-Acquia Search integration isn't properly deployed. Specifically, the following are not set:

API host: acquia_search.settings config value for api_host
API key: acquia_search.api_key state
Identifier: acquia_search.identifier state
UUID: acquia_search.uuid state

As a result, the following warning is displayed on the 'Edit search server Acquia Search API Solr server' page (/admin/config/search/search-api/server/acquia_search_server/edit):

Could not find a Solr core corresponding to your website and environment. Your subscription contains no cores. To fix this problem, please read [our documentation](https://docs.acquia.com/acquia-search/multiple-cores/).

Relevant code:

/**
 * Implements hook_install().
 */
function acquia_search_install() {
  // Import settings from the connector if it is installed and configured.
  $connector = \Drupal::moduleHandler()->moduleExists('acquia_connector');
  $subscription = \Drupal::state()->get('acquia_subscription_data');
  $storage = new Storage();
  if ($connector && isset($subscription)) { // <-- Acquia Connector isn't installed yet, so nothing herein is executed.
    $storage->setApiHost(\Drupal::config('acquia_search.settings')->get('api_host') ?? 'https://api.sr-prod02.acquia.com');
    $storage->setApiKey(\Drupal::state()->get('acquia_connector.key'));
    $storage->setIdentifier(\Drupal::state()->get('acquia_connector.identifier'));
    $storage->setUuid($subscription['uuid']);
  }
}

Steps to reproduce

  1. Install Acquia Connector
  2. Install Acquia Search
  3. Observe Solr core is correctly registered by Acquia Search
  1. Install Acquia Connector and Acquia Search (same time)
  2. Observe Solr core is not registered by Acquia Search

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

None

Data model changes

None

Comments

Chris Burge created an issue. See original summary.

japerry’s picture

Version: 3.x-dev » 3.0.9
Status: Active » Closed (outdated)

Marking outdated, as this has been fixed/rewritten in the 3.1.x branch and 3.0.x is going end of life.

mglaman’s picture

For those following, this can be remedied with Drush for an immediate fix. Replace items within {} to proper product keys and application ID values.

drush state:set acquia_connector.identifier {AH_NETWORK_IDENTIFIER}
drush state:set acquia_connector.key {AH_NETWORK_KEY}
drush state:set acquia_subscription_data '{"uuid": "{AH_APPLICATION_ID"}' --input-format=json

# If saving the Search API server form did not work, try this.
drush state:set acquia_search.identifier {AH_NETWORK_IDENTIFIER}
drush state:set acquia_search.api_key {AH_NETWORK_KEY}
drush state:set acquia_search.uuid {AH_APPLICATION_ID"}