Magento2: setup:upgrade not possible in after installing Sample Data Magento 2.4.1

Created on 28 Oct 2020  路  13Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento version 2.4.1
  2. PHP 7.4.11
  3. MYSQL 8.0.22
  4. ES 7.6.2

Steps to reproduce (*)

  1. Setup basic magento installation.
  2. Set Magento into Production Mode bin/magento deploy:mode:set production
  3. Install Magento Sample data using command: sampledata:deploy
  4. Use command setup:upgrade.

Expected result (*)

  1. setup upgrade activates modules and installs the sample data in the database.

Actual result (*)

Error thrown:
image

unable to apply data patch magentocatalogrulesampledatasetuppatchdatainstallcatalogrulesampledata for module magento_catalogrulesampledata. original exception message: rolled back transaction has not been completed correctly.

In the system log:
[2020-10-28 11:12:45] main.ERROR: Sample Data error: Unable to unserialize value. Error: Syntax error [] []

Returning the string that causes the error is:
string(352) "{"type":"Magento\CatalogRule\Model\Rule\Condition\Combine","attribute":null,"operator":null,"value":"1","is_value_processed":null,"aggregator":"all","conditions":[{"type":"Magento\CatalogRule\Model\Rule\Condition\Product","attribute":"category_ids","operator":"()","value":%url_key=pants-women,url_key=pants-men%,"is_value_processed":false}]}"

When returning an empty array instead of throwing the error it continues into the next error:

Module 'Magento_ConfigurableSampleData':
Running data recurring...{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."}],"type":"illegal_argument_exception","reason":"Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."},"status":400}

Additional info from Engcom

Precondition MySQL 8

Steps to reproduce

  1. Install Magento 2.4.1 using composer create-project --repository=https://repo.magento.com/ magento/project-community-edition=2.4.1 .
  2. Deploy Sampledata bin/magento sampledata:deploy
  3. Perform Upgrade bin/magento setup:upgrade

Actual Result

Setup upgrade is aborted with an error
:x: _Unable to apply data patch MagentoCatalogRuleSampleDataSetupPatchDataInstallCatalogRuleSampleData for module Magento_CatalogRuleSampleData. Original exception message: Rolled back transaction has not been completed correctly._
rolled_back

SampleData Confirmed P1 done Reported on 2.4.1 Reproduced on 2.4.x S1

Most helpful comment

Seems like the cause of the issue is MySQL 8.
We confirm that the issue is reproducible.

Thank you for your report

All 13 comments

Hi @NielsVroman. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


  • Join Magento Community Engineering Slack and ask your questions in #github channel.

    :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Hello @NielsVroman

Thank you for your report

We have rechecked the reported issue on Magento 2.4.1 and did not face any error

We have successfully deployed Sample Data using the command bin/magento sampledata:deploy And successfully Upgraded the instance using bin/magento setup:upgrade

Can you please provide more information about your store and settings?

Thank you in advance

@engcom-Bravo I'll try to give some more info, this is al i've got:

server is setup with
PHP 7.4.11
MYSQL 8.0.22
ES 7.6.2

The commands we used to set magento up are as followed:
composer create-project --repository-url=https://repo.magento.com/ "$MagentoEdition" "$INSTALL_DIR" "$MagentoVersion"
Where the magento version is 2.4.1, and edition is magento/project-community-edition

"$INSTALL_DIR/bin/magento" setup:install --base-url="$MAGENTO_BASE_URL"
--backend-frontname="$MAGENTO_BACKEND_FRONTNAME"
--db-host="$MAGENTO_DB_HOST"
--db-name="$MAGENTO_DB_NAME"
--db-user="$MAGENTO_DB_USER"
--db-password="$MAGENTO_DB_PASSWORD"
--admin-firstname="$MAGENTO_ADMIN_FIRSTNAME"
--admin-lastname="$MAGENTO_ADMIN_LASTNAME"
--admin-email="$MAGENTO_ADMIN_EMAIL"
--admin-user="$MAGENTO_ADMIN_USER"
--admin-password="$MAGENTO_ADMIN_PASSWORD"
--language=nl_BE
--currency=EUR
--timezone=Europe/Brussels
--use-rewrites=1
--use-secure=1
--use-secure-admin=1
--admin-use-security-key=1
--session-save=redis --key="$MAGENTO_ENCRYPTKEY"
--cleanup-database
--consumers-wait-for-messages=0

after this, we set the permissions.

"$RUN_DIR/bin/magento" cron:install
"$RUN_DIR/bin/magento" deploy:mode:set production
"$RUN_DIR/bin/magento" setup:config:set --cache-backend=redis --cache-backend-redis-server="$MAGENTO_REDIS_SERVER" --cache-backend-redis-db=3
"$RUN_DIR/bin/magento" setup:config:set --page-cache=redis --page-cache-redis-server="$MAGENTO_REDIS_SERVER" --page-cache-redis-db=4

after this some configurations.
#General admin stuff
"$RUN_DIR/bin/magento" config:set -e web/cookie/cookie_lifetime 86400;
"$RUN_DIR/bin/magento" config:set -c web/secure/enable_upgrade_insecure 1

#Elastic search
"$RUN_DIR/bin/magento" config:set -e catalog/search/engine elasticsearch7
"$RUN_DIR/bin/magento" config:set -e catalog/search/elasticsearch7_server_hostname localhost
"$RUN_DIR/bin/magento" config:set -e catalog/search/elasticsearch7_server_port 9200
"$RUN_DIR/bin/magento" config:set -e catalog/search/elasticsearch7_index_prefix magento2
"$RUN_DIR/bin/magento" config:set -e catalog/search/elasticsearch7_enable_auth 0
"$RUN_DIR/bin/magento" config:set -e catalog/search/elasticsearch7_server_timeout 15

#Europe/Belgium stuff
"$RUN_DIR/bin/magento" config:set -c general/locale/firstday 1
"$RUN_DIR/bin/magento" config:set -c general/locale/weight_unit "kgs"
"$RUN_DIR/bin/magento" config:set -c general/country/default BE

After this completes magento is running.
We install the sample data using the command.
And do setup:upgrade here it fails.

This is about everything i can give regarding the setup of magento.
These are also the only settings that are set.
No other settings were touched.

Hello @NielsVroman

Thank you for the quick response

We are able to reproduce the issue. We have discovered that the main cause of the issue is the Production Mode

Additional info from Engcom is added to the description

:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-38788 were created

Issue Available: @engcom-Bravo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Further investigation discovered that according to Install Sample Data using Composer article on Developer Documentation, _Installing sample data in production mode fails._ Please use Developer modebin/magento deploy:mode:set developer to install Sample Data and Upgrade

@engcom-Bravo Hey, thanks for your investigation. I use latest docker image from https://github.com/bitnami/bitnami-docker-magento and it still fails (also in dev mode)

We had the same issue as described by @NielsVroman, deploying the sample data after installing Magento resulted in the Unable to apply data patch error message.

Explicitly setting Magento to Developer Mode before deploying the sample data did not help, we had the same error message.

We were able to resolve it by deploying the sample data before installing Magento however. Our workflow now is this:

composer create-project ...
bin/magento deploy:mode:set developer
bin/magento sampledata:deploy
bin/magento setup:install ...
bin/magento setup:upgrade
bin/magento cache:clean

I'm reopening this issue for further investigation

Seems like the cause of the issue is MySQL 8.
We confirm that the issue is reproducible.

Thank you for your report

:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-38788 were created

Issue Available: @engcom-Bravo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @engcom-Golf. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

Was this page helpful?
0 / 5 - 0 ratings