pimcore / ecommerce-framework-bundle

Ecommerce Framework community bundle provides e-commerce functionality such as product listing and filtering, pricing, carts and checkouts for Pimcore.
https://pimcore.com/docs/platform/Ecommerce_Framework/
Other
11 stars 33 forks source link

[Bug]: The 'kernel' service is synthetic, it needs to be set at boot time when running update index command on 11.3.1 #202

Open lucas-langa opened 2 months ago

lucas-langa commented 2 months ago

Pimcore version

11.3.1

Steps to reproduce

php bin/console ecommerce:indexservice:bootstrap --update-index

Actual Behavior

429 from opensearch image then "The 'kernel' service is synthetic, it needs to be set at boot time" error Screenshot from 2024-09-18 10-30-00

Expected Behavior

products get saved in opensearch index

medovanx commented 1 month ago

I have the same issue on Pimcore 11.4.0 using ES8 image

fashxp commented 1 month ago

related to https://github.com/pimcore/data-importer/issues/420?

mattamon commented 1 month ago

@lucas-langa Thank you for sharing this bug with us.

My first note would be, how does this even work with OpenSearch? Currently we are not supporting OpenSearch with the E-Commerce Framework. I would need some more details here if you are able to share them.

@medovanx I trued to reproduce the issue with ES8 in our docker setup, but was not able to reproduce it. Can you please also provide more infos about how you setup elasticsearch?

medovanx commented 1 month ago

@mattamon

I used docker-compose with the following service

    elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0
        ports:
            - "9200:9200"
        volumes:
            - es_data:/usr/share/elasticsearch/data
        environment:
            - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
            - "discovery.type=single-node"
            - xpack.security.enabled=false

and contents of ./config/ecommerce/elastic-search.yaml

pimcore_ecommerce_framework:
    index_service:
        tenants:
            EcommerceProductIndex:
                worker_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Worker\ElasticSearch\DefaultElasticSearch8
                config_id: Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Config\ElasticSearch

                config_options:
                    client_config:
                        logging: false
                        indexName: 'product-index'

                    # elasticsearch client name, for Elasticsearch 8 only
                    es_client_name: default

                    index_settings:
                        number_of_shards: 5
                        number_of_replicas: 0
                        max_ngram_diff: 30
                        analysis:
                            analyzer:
                                my_ngram_analyzer:
                                    tokenizer: my_ngram_tokenizer
                                allow_list_analyzer:
                                    tokenizer: standard
                                    filter:
                                      - allow_list_filter
                            tokenizer:
                                my_ngram_tokenizer:
                                    type: ngram
                                    min_gram: 2
                                    max_gram: 15
                                    token_chars: [letter, digit]
                            filter:
                                allow_list_filter:
                                    type: keep
                                    keep_words:
                                      - was
                                      - WAS

pimcore_elasticsearch_client:
    es_clients:
        default:
            hosts: ['%env(ELASTICSEARCH_HOST)%:%env(ELASTICSEARCH_PORT)%']
            logger_channel: 'pimcore.elasticsearch'    

The Product class is called "Products" so I specify by running

bin/console \
ecommerce:indexservice:bootstrap --update-index \
--object-list-class Pimcore\\Model\\DataObject\\Products\\Listing```

I have the following in services.yaml because it was complaining of this method not being public when running the update-index command

    Symfony\Component\Lock\LockFactory:
        public: true

The Products class

Implements Interface: \Pimcore\Bundle\EcommerceFrameworkBundle\Model\IndexableInterface Uses this Trait: \App\Ecommerce\IndexService\IndexableTrait

mattamon commented 1 month ago

@medovanx thank you for your detailed description. I checked for differences and I updated my elastic search image. I still cannot reproduce this issue.

When does this error occur? Everytime you reindex your Products?

Do you manually execute the command or is it scheduled?

medovanx commented 1 month ago

@medovanx thank you for your detailed description. I checked for differences and I updated my elastic search image. I still cannot reproduce this issue.

When does this error occur? Everytime you reindex your Products?

Do you manually execute the command or is it scheduled?

Yep everytime I try to index, I run it manually

mattamon commented 1 month ago

@medovanx thank you for your detailed description. I checked for differences and I updated my elastic search image. I still cannot reproduce this issue. When does this error occur? Everytime you reindex your Products? Do you manually execute the command or is it scheduled?

Yep everytime I try to index, I run it manually

Hmm okay, maybe some of my colleagues have to try it, but for me currently it works everytime. Thanks for your detailed description though!

lukmzig commented 1 month ago

This error suggests that the kernel service isn't being properly initialized or injected when running the index update

@medovanx since we are not able to reproduce this error, could you maybe share with us how and from where are you running the command exactly? What project setup are you using?

medovanx commented 1 month ago

@lukmzig I already shared the setup above, could you please clarify what other details you need? I'd be happy to provide it

and also I'm running using docker compose exec php-fpm bin/console ~~~~

mattamon commented 1 month ago

@medovanx e.g. that you are using console-parallelization even thought we tried it with running it with console-parallelization we could not reproduce it unfortunately. Can you give us a rought amount on how many products you are processing? So maybe we can update our test database.

Also you are using your own trait, the indexable trait. What does it do?