wardenenv / warden-env-magento2

Template Project for Magento 2 Using Warden for Local Development
https://docs.warden.dev/
55 stars 23 forks source link

warden bootstrap --clean-install fails with Magento 2.4.3 #16

Closed mattijv closed 1 year ago

mattijv commented 3 years ago

Steps to reproduce:

  1. git clone -b develop git@github.com:davidalger/warden-env-magento2.git .
  2. warden bootstrap --clean-install --meta-version 2.4.3

Expected result:

Magento 2.4.3 is installed successfully.

Actual result:

The bootstrap fails at the Magento installation step with the following error:

Call to undefined method Magento\Eav\Api\Data\AttributeExtension::setIsPagebuilderEnabled()#0 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(146): Magento\PageBuilder\Plugin\Catalog\Model\Product\Attribute\RepositoryPlugin->afterGet(Object(Magento\Catalog\Model\Product\Attribute\Repository\Interceptor), Object(Magento\Catalog\Model\ResourceModel\Eav\Attribute\Interceptor), 'sku')

More info:

It seems that for some reason the AttributeExtension class gets generated without the setIsPagebuilderEnabled and getIsPagebuilderEnabled methods. On the other hand, in an instance that was update from 2.4.1 to 2.4.3 the AttributeExtension class is generated with those methods.

I did not yet have a chance to debug this further, and did not try doing a clean install of Magento 2.4.3 using the official instructions, so this might be a purely Magento issue.

hardyjohnson commented 3 years ago

@mattijv this is related to page builder issue 730: https://github.com/magento/magento2-page-builder/issues/730.

There is a PR / patch created.

https://patch-diff.githubusercontent.com/raw/magento/magento2-page-builder/pull/778 https://patch-diff.githubusercontent.com/raw/magento/magento2-page-builder/pull/778.patch

mattijv commented 3 years ago

@hardyjohnson Thank you. I didn't think to check the PageBuilder repo and for some reason a Google search does not bring up that issue even when I searched for the exact error message...

As per @guvra s comment on https://github.com/magento/magento2-page-builder/issues/730, the issue seems to be related to the existence of app/etc/config.php on install. If I run

touch webroot/app/etc/config.php

and remove the part from bootstrap.cmd command that would delete the config.php file, the install progresses past the PageBuilder step just fine and the AttributeExtension class is generated correctly.

However, I run into a new error after the installation has progressed most of the way:

...
Module 'Vertex_AddressValidation':
[Progress: 1380 / 1386]
Module 'Yotpo_Yotpo':
[Progress: 1381 / 1386]
Enabling caches:
Current status:
layout: 1
block_html: 1
full_page: 1
[Progress: 1382 / 1386]
Caches clearing:
Cache cleared successfully
[Progress: 1383 / 1386]
Disabling Maintenance Mode:

In ResourceConnection.php line 148:

  Connection "default" is not defined

I'm unsure why this happens as env.php contains the correct config for the DB connection and if I add logging to the DeploymentConfig class, the resource connection config is loaded succesfully multiple times before that step.

That said, I'm unsure if that patch is the correct way to solve this, as it seems to be just masking the real issue (the AttributeExtension class being generated without the correct extension methods). I can, of course, be way wrong about that.

mattijv commented 3 years ago

The missing resource config issue happens because there are multiple instances of the DeploymentConfig class being created in the install process, and the first instance loads the partial env.php.init.php file. This instance is never reset, and when it's used for accessing the resource connection later in the process the cached data does not include the current env.php contents.

hardyjohnson commented 3 years ago

@mattijv I read your comments, this is interesting analysis. I still think adding the defensive programming patch makes sense, not that there could not also be a root cause that needs to be addressed as well. If I have some time I may look at this again in a few weeks.