Collective.elasticsearch - ComponentLookupError: (<InterfaceClass plone.registry.interfaces.IRegistry>, '')

Hello everyone!

I'm having some issues with GitHub - collective/collective.elasticsearch: Plone ElasticSearch Integration · GitHub .

When I try to create a new Plone site I get this error, this happens even if I simply add the dependency in pyproject.toml

Environment:

plone = 6.1.3

collective-elasticsearch = 5.0.0

Traceback (most recent call last):

File "/app/bin/zconsole", line 7, in

 sys.exit(main())

          ^^^^^^

File "/app/lib/python3.12/site-packages/Zope2/utilities/zconsole.py", line 50, in main

 runscript(namespace.zopeconf, \*namespace.scriptargs)

File "/app/lib/python3.12/site-packages/Zope2/utilities/zconsole.py", line 22, in runscript

 exec(compile(scriptcode, script_name, 'exec'), scriptglobals)

File "/app/scripts/create_site.py", line 65, in

 site = addPloneSite(app, site_id, \*\*payload)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/Products/CMFPlone/factory.py", line 163, in addPloneSite

 site = site_api.\_create_site(

        ^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/distribution/api/site.py", line 102, in _create_site

 site = \_create_bare_site(context, answers, profile_id)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/distribution/api/site.py", line 61, in _create_bare_site

 setup_tool.runAllImportStepsFromProfile(f"profile-{profile_id}")

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 393, in runAllImportStepsFromProfile

 result = self.\_runImportStepsFromContext(

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 1513, in _runImportStepsFromContext

 self.\_doRunHandler(post_handler)

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 1360, in _doRunHandler

 return handler_function(self)

        ^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/Products/CMFPlone/setuphandlers.py", line 139, in importFinalSteps

 st.runAllImportStepsFromProfile("profile-Products.CMFPlone:dependencies")

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 393, in runAllImportStepsFromProfile

 result = self.\_runImportStepsFromContext(

          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 1504, in _runImportStepsFromContext

 message = self.\_doRunImportStep(step, context)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/Products/GenericSetup/tool.py", line 1316, in _doRunImportStep

 return handler(context)

        ^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/app/intid/setuphandlers.py", line 59, in registerContent

 registered, existing = register_all_content_for_intids(portal)

                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/app/intid/setuphandlers.py", line 28, in register_all_content_for_intids

 for brain in cat(query):

              ^^^^^^^^^^

File "/app/lib/python3.12/site-packages/collective/elasticsearch/patches/_init_.py", line 25, in safeSearchResults

 active = manager.active

          ^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/collective/elasticsearch/manager.py", line 104, in active

 return self.enabled and self.catalog_converted

        ^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/collective/elasticsearch/manager.py", line 57, in enabled

 value = api.portal.get_registry_record(

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/decorator.py", line 235, in fun

 return caller(func, \*(extras + args), \*\*kw)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/api/validation.py", line 73, in wrapped

 return function(\*args, \*\*kwargs)

        ^^^^^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/plone/api/portal.py", line 280, in get_registry_record

 registry = getUtility(IRegistry)

            ^^^^^^^^^^^^^^^^^^^^^

File "/app/lib/python3.12/site-packages/zope/component/_api.py", line 180, in getUtility

 raise ComponentLookupError(interface, name)

zope.interface.interfaces.ComponentLookupError: (, '')

The error is strange but 5.0.0 is for Plone 5.2 and above. But I think many things changed, then try to use the master version. There's a fix here:

that is in master.

Here the issue: ComponentLookupError when adding a Plone site · Issue #118 · collective/collective.elasticsearch · GitHub

@F-Chitz Mind trying the 6.x branch ?

Works on my end with Plone 6.1.4 and I’m maintaining this branch :slight_smile: