akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

Inconsistent result from rest api api/rest/v1/products #20466

Closed HuyNguyen206 closed 3 weeks ago

HuyNguyen206 commented 1 month ago

:bug: I'm reporting a Bug :bug:

Currently, when I use the API api/rest/v1/products?with_count=false&scope=ecommerce&locales=en_US,vi_VN&pagination_type=search_after&limit=100&search=%7B%22family%22:%5B%7B%22operator%22:%22NOT%20IN%22,%22value%22:%5B%22Accessories%22,%22Animal%22,%22battery%22,%22beverage%22,%22dhp%22,%22equipment%22,%22food%22,%22lounge%22,%22montclair%22,%22nespresso%22,%22nonfood%22,%22nongoods%22,%22service%22,%22voucher%22,%22wine%22%5D%7D,%7B%22operator%22:%22IN%22,%22value%22:%5B%22Console%22%5D%7D%5D,%22updated%22:%5B%7B%22operator%22:%22BETWEEN%22,%22value%22:%5B%222024-07-20%2000:00:00%22,%222024-07-25%2023:59:59%22%5D%7D%5D%7D to fetch the product data from PIM, sometime it returns the result like below screenshot image

sometimes it return the empty items like this image

This URL was used by plugin magento2-connector-community (101.3.4) to import product from PIM to Magento.

When I turn off the Elasticsearch container, the issue won't occur anymore, so I think the issue might related to Elasticsearch, I already run these commands below to reset the index before:

akeneo:elasticsearch:reset-indexes 
pim:product:index --all 
pim:product-model:index --all

This is my docker-compose.yml:

services:
  php:
    environment:
      APP_ENV: '${APP_ENV:-prod}'
      COMPOSER_HOME: '/var/www/.composer'
      PHP_IDE_CONFIG: 'serverName=pim-docker-cli'
      XDEBUG_MODE: '${XDEBUG_MODE:-off}'
      XDEBUG_CONFIG: 'client_host=172.17.0.1'
      BLACKFIRE_CLIENT_ID: '${BLACKFIRE_CLIENT_ID:-client_id}'
      BLACKFIRE_CLIENT_TOKEN: '${BLACKFIRE_CLIENT_TOKEN:-client_token}'
      EXPERIMENTAL_TEST_DATABASE: '${EXPERIMENTAL_TEST_DATABASE:-0}'
    volumes:
      - './:/srv/pim'
      - 'composer_cache:/srv/cache/.composer'
      - './docker/php/custom.ini:/etc/php/8.1/cli/conf.d/99-custom.ini'
    working_dir: '/srv/pim'
    user: 'www-data' # www-data
    command: 'php bin/console messenger:consume ui_job import_export_job data_maintenance_job -vvv'
#    command: 'php'
    init: true
    networks:
      - 'pim'

  fpm:
    environment:
      APP_ENV: '${APP_ENV:-prod}'
      BEHAT_TMPDIR: '/srv/pim/var/cache/tmp'
      BEHAT_SCREENSHOT_PATH: '/srv/pim/var/tests/screenshots'
      PHP_IDE_CONFIG: 'serverName=pim-docker-web'
      XDEBUG_MODE: '${XDEBUG_MODE:-off}'
      XDEBUG_CONFIG: 'client_host=172.17.0.1'
      BLACKFIRE_CLIENT_ID: '${BLACKFIRE_CLIENT_ID:-client_id}'
      BLACKFIRE_CLIENT_TOKEN: '${BLACKFIRE_CLIENT_TOKEN:-client_token}'
    volumes:
      - './:/srv/pim'
      - 'composer_cache:/srv/cache/.composer'
      - './docker/php/custom.ini:/etc/php/8.1/fpm/conf.d/99-custom.ini'
    working_dir: '/srv/pim'
    command: 'php-fpm -F'
    networks:
      - 'pim'

  node:
    environment:
      YARN_CACHE_FOLDER: '/home/node/.yarn'
    volumes:
      - './:/srv/pim'
      - 'yarn_cache:/srv/cache/.yarn'
    working_dir: '/srv/pim'
    networks:
      - 'pim'

  httpd:
    image: 'httpd:2.4'
    environment:
      APP_ENV: '${APP_ENV:-prod}'
    depends_on:
      - 'fpm'
    volumes:
      - './:/srv/pim:ro'
      - './docker/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro'
      - './docker/akeneo.conf:/usr/local/apache2/conf/vhost.conf:ro'
      - './docker/server.crt:/usr/local/apache2/conf/server.crt:ro'
      - './docker/server.key:/usr/local/apache2/conf/server.key:ro'
      - './docker/php/logs:/var/log'
    networks:
      - 'pim'

  mysql:
    image: 'mysql:8.0.30'
    command: '--default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1'
    volumes:
      - akeneo_mysql_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 'root'
      MYSQL_USER: '${APP_DATABASE_USER}'
      MYSQL_DATABASE: '${APP_DATABASE_NAME}'
      MYSQL_PASSWORD: '${APP_DATABASE_PASSWORD}'
    networks:
      - 'pim'

  elasticsearch:
    image: 'elastic/elasticsearch:8.4.2'
    environment:
      ES_JAVA_OPTS: '${ES_JAVA_OPTS:--Xms1g -Xmx1g}'
      discovery.type: 'single-node'
      xpack.security.enabled: 'false'
      indices.id_field_data.enabled: 'true'
    networks:
      - 'pim'

  object-storage:
    image: 'minio/minio:RELEASE.2021-09-15T04-54-25Z'
    entrypoint: '/bin/sh -c "mkdir -p /data/archive /data/catalog /data/jobs /data/category /data/catalogs_mapping && minio server --console-address :9091 /data"'
    environment:
      MINIO_ACCESS_KEY: 'AKENEO_OBJECT_STORAGE_ACCESS_KEY'
      MINIO_SECRET_KEY: 'AKENEO_OBJECT_STORAGE_SECRET_KEY'
    networks:
      - 'pim'

networks:
  pim:

volumes:
  yarn_cache:
    external: true
  composer_cache:
    external: true
  akeneo_mysql_data:

and this is docker-compose.override.yml

services:
    php:
        build:
            context: ./docker/php
            dockerfile: Dockerfile
            args:
                uid: ${UID:-1001}
                gid: ${GID:-1001}
        environment:
            APP_ENV: 'dev'
        volumes:
            - ./docker/php/xdebug_cli.ini:/etc/php/8.1/cli/conf.d/99-akeneo-xdebug.ini
        user: ${UID:-1001}

    fpm:
        build:
            context: ./docker/php
            dockerfile: Dockerfile
            args:
                uid: ${UID:-1001}
                gid: ${GID:-1001}
        environment:
            APP_ENV: 'dev'
        volumes:
            - ./docker/php/xdebug_web.ini:/etc/php/8.1/fpm/conf.d/99-akeneo-xdebug.ini
            - ./docker/php/www.conf:/etc/php/8.1/fpm/pool.d/www.conf
    node:
        build:
            context: ./docker/node
            dockerfile: Dockerfile
            args:
                uid: ${UID:-1001}
                gid: ${GID:-1001}

    httpd:
        environment:
            APP_ENV: 'dev'
        ports:
            - '${DOCKER_PORT_HTTP:-8080}:80'
        volumes:
            - './:/srv/pim:ro'
            - './docker/akeneo-dev.conf:/usr/local/apache2/conf/vhost.conf:ro'

    mysql:
        ports:
            - '${DOCKER_PORT_MYSQL:-33006}:3306'
        volumes:
#            - ./docker/mysql/db:/var
#            - ./docker/mysql/my.cnf:/etc/mysql/my.cnf
            - ./docker/mysql/my8.0.30.cnf:/etc/my.cnf

    elasticsearch:
        ports:
            - '${DOCKER_PORT_ELASTICSEARCH:-9210}:9200'
        volumes:
            - ./docker/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
            - database_akeneo_es_data:/usr/share/elasticsearch/data
    #            - ./docker/elasticsearch/sysctl.conf:/etc/sysctl.conf
    object-storage:
        ports:
            - '${DOCKER_PORT_OBJECT_STORAGE:-9090}:9000'

volumes:
    yarn_cache:
        external: false
    composer_cache:
        external: false
    database_akeneo_es_data:

Below is the attached elasticsearch log and system log file: akeneo-pim-system-info_2024-07-23_09_46.txt es_log.txt

Thank you in advance.

HuyNguyen206 commented 3 weeks ago

Can not reproduce this issue anymore