Overview
The following JSON:API related error occurred. This is a note on how to resolve it.
サイトに予期せぬエラーが起こりました。しばらくたってから再度お試しください。
TypeError: Drupal\jsonapi_search_api_facets\Plugin\facets\facet_source\JsonApiFacets::__construct(): Argument #6 ($index) must be of type Drupal\search_api\IndexInterface, null given, called in /home/j-soken/drupal/web/modules/contrib/jsonapi_search_api/modules/jsonapi_search_api_facets/src/Plugin/facets/facet_source/JsonApiFacets.php on line 61 in Drupal\jsonapi_search_api_facets\Plugin\facets\facet_source\JsonApiFacets->__construct() (line 48 of modules/contrib/jsonapi_search_api/modules/jsonapi_search_api_facets/src/Plugin/facets/facet_source/JsonApiFacets.php).
Drupal\jsonapi_search_api_facets\Plugin\facets\facet_source\JsonApiFacets::create() (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 83)
Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 251)
facets_system_breadcrumb_alter() (Line: 545)
Drupal\Core\Extension\ModuleHandler->alter() (Line: 94)
Drupal\Core\Breadcrumb\BreadcrumbManager->build() (Line: 72)
Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender()
call_user_func_array() (Line: 101)
...
Solution
First, enable error display. Add the following to the configuration file.
$config['system.logging']['error_level'] = 'verbose';
The issue was resolved by uninstalling the JSON:API related modules using drush and then reinstalling them.
drush pm:uninstall drupal/search_api drupal/facets drupal/jsonapi_search_api drupal/jsonapi_search_api_facets
Note that drush needed to be installed to run the above on Sakura’s rental server. I installed it by following the page below.
https://www.drush.org/12.0.1/install/
composer require drush/drush
vendor/bin/drush pm:uninstall drupal/search_api drupal/facets drupal/jsonapi_search_api drupal/jsonapi_search_api_facets
After that, the modules were reinstalled with the following command.
composer require drupal/search_api drupal/facets drupal/jsonapi_search_api drupal/jsonapi_search_api_facets
Summary
I hope this is helpful for anyone experiencing a similar error.