YotpoLtd / magento2-module-yotpo-reviews

Open Software License 3.0
23 stars 38 forks source link

php bin/magneto - Connection "default" is not definfed #148

Closed guido7171 closed 5 years ago

guido7171 commented 5 years ago

Reproduce:

After a git clone m2.project.git Or clean install ^m2.3.0 with in composer.json

        "magento/product-community-edition": "2.3.1",
        "yotpo/module-review": "^2.7",

composer install

php bin/magento will break on getCommands.

In ResourceConnection.php line 149:

  [DomainException]                         
  Connection "default" is not definfed

The Yotpo Console Commands Classes have a di constructor dependency on Magento\Framework\App\ResourceConnection.

app/etc/env.php isn't ready yet because we're building the deploy.

I will think about a solution later on

markshust commented 5 years ago

this is a big issue. i needed to clone this repo out locally to app/code and remove the entire Console folder in order to deploy to magento cloud (which also doesn't use an env.php file in the build process).

it's best practice to not have db calls within console scripts. the calls can be done by calling models directly, etc.

stoopman commented 5 years ago

We also have this issue, it's bad practise to use Resource connection classes as dependency injection. The build phase should not depend on a resource connection, due to this our CI/CD is failing.

Temporary solution is to either fork this repo and change the console commands, or include this module in your project's repo (app/code).

Hope you can make a proper solution for this problem!

wabakok-zz commented 5 years ago

Hi All,

Thanks for raising this. We've just started QAing a fix for this one. We'll update here once it's live.

Thanks!

wabakok-zz commented 5 years ago

We've just released a new version of our plugin which should also address this issue. It's not available on Magento Marketplace yet, you'll need to install it from our repo.
If you're still seeing this happening please let us know ASAP.

Thanks!

guido7171 commented 5 years ago

@wabakok The proxy fixing seems to be fixing the issue :+1:

markshust commented 5 years ago

nice use of proxy 👍

tahiryasin commented 2 years ago

Sometimes this error occurs when you empty the database and re run the installation command. Deleting below files will fix the issue. app/etc/config.php app/etc/env.php