I am using this module to setup decoupled commerce site demo.
For site installation from configuration, I am using "config_installer" profile. Reason is i have other configurations as well (apart from provided by commerce_Demo module)
When we install module first time, it works fine.
Now I export configuration, as i have done some changes in configuration.
All the configuration provides by module is copied inside "config/sync" directory.
Now, when i try to install site I get following error.
Error: Call to a member function indexItems() on null in /var/www/html/experiments/commerce-d8/web/modules/contrib/commerce_demo/commerce_demo.install on line 33 #0 [internal function]: commerce_demo_install()
So it seems that when "commerce_demo" is running it's hook install somehow configuration related to it is not loaded/created yet.
To debug issue: I changed weight of module and set that it executes last but it will still show above error and content won't import.
To run content import process separately, I created a drush command and using content import service from there. It does the job.
However, to fix the error on line 33, commerce_Demo.install - we should check if index is not NULL
If it is not null then only we should call indexItems() method.
I have attached simple patch to make it work.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2976888-2-search-api-index-not-loaded.patch | 470 bytes | mohit_aghera |
Comments
Comment #2
mohit_aghera commentedComment #3
mohit_aghera commentedComment #4
mglamanThis is a Search API issue, see #2949379: Index not imported properly at module install. Can you try against -dev of Search API?
Comment #5
mglamanClosing as duplicate. The real fix will be in #2986710: Run index of products after the module has been installed.. Blocked on Search API release.