pimcore / customer-data-framework

Customer Data Framework community bundle adds capability for management of customer data to Pimcore.
https://pimcore.com/docs/platform/Customer_Management_Framework/
Other
80 stars 93 forks source link

[Bug]: Bundle install fails with an error #476

Closed perharstrom closed 1 year ago

perharstrom commented 1 year ago

Expected behavior

Bundle should install successfully

Actual behavior

Bundle install fails with an error

Steps to reproduce

  1. Install Pimcore 10.6.1 (with MySQL 8.0).
  2. run composer.sh require pimcore/customer-management-framework-bundle:^3 (ver 4 requires Pimcore 11).
  3. Enable the bundle from "Bundles & Bricks" in Pimcore admin.
  4. Install the bundle from "Bundles & Bricks" in Pimcore admin.

Installation fails with the following error:

Status: 400 | 
URL: /admin/extensionmanager/admin/install
Method: POST
Message: An exception occurred while executing 'DROP FUNCTION IF EXISTS PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS;

CREATE FUNCTION PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS(elementIdent INT) RETURNS TEXT
  READS SQL DATA
  BEGIN
    DECLARE segmentIds TEXT;
    DECLARE elementExists TINYINT;
    DECLARE breaks TINYINT;

    SELECT `segments` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO segmentIds;
    SELECT COUNT(*) FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO elementExists;
    SELECT `breaksInheritance` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO breaks;

    WHILE (elementExists = 0 OR breaks IS NULL OR breaks  1 DO
      SELECT `parentId`  FROM `documents` WHERE `id` = elementIdent INTO elementIdent;
      SELECT CONCAT_WS(',', segmentIds, (SELECT `segments` FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document')) INTO segmentIds;
      SELECT COUNT(*) FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document' INTO elementExists;
      SELECT `breaksInheritance` INTO breaks FROM `plugin_cmf_segment_assignment` WHERE `elementId` = elementIdent AND `elementType` = 'document';
    END WHILE;

    RETURN segmentIds;
  END
':

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
perharstrom commented 1 year ago

Tried to add log_bin_trust_function_creators = ON (as mentioned in the error message) and now it works. Should this setting be added as a requirement perhaps?

kingjia90 commented 1 year ago

Resolved by #484

It should be enough, at least is more in line with this image

Extra useful notes on the specific error https://wiki.ispirer.com/sqlways/troubleshooting-guide/mysql/import/binary-logging