-
Notifications
You must be signed in to change notification settings - Fork 79
Labels
bugSomething isn't workingSomething isn't working
Description
After upgrading to 3.9.0 our CI pipelines fail for unit and integration tests.
In our unit test pipeline we run setup:di:compile in an environment without Magento being properly installed. There is no database or env.php.
Running bin/magento setup:di:compile
fails with this error:
In WebsiteRepository.php line 159:
The default website isn't defined. Set the website and try again.
The same is true for our integration test pipeline, where we get this error when running the Magento install command.
In WebsiteRepository.php line 159:
[DomainException]
The default website isn't defined. Set the website and try again.
Exception trace:
at /var/www/html/vendor/magento/module-store/Model/WebsiteRepository.php:159
Magento\Store\Model\WebsiteRepository->getDefault() at /var/www/html/vendor/magento/module-store/Model/StoreResolver/Website.php:49
Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds() at /var/www/html/vendor/magento/module-store/Model/StoresData.php:67
Magento\Store\Model\StoresData->getStoresData() at /var/www/html/vendor/magento/module-store/Model/StoreResolver.php:138
Magento\Store\Model\StoreResolver->getStoresData() at /var/www/html/vendor/magento/module-store/Model/StoreResolver.php:97
Magento\Store\Model\StoreResolver->getCurrentStoreId() at /var/www/html/generated/code/Magento/Store/Model/StoreResolver/Proxy.php:105
Magento\Store\Model\StoreResolver\Proxy->getCurrentStoreId() at /var/www/html/vendor/magento/module-store/Model/StoreManager.php:159
Magento\Store\Model\StoreManager->getStore() at /var/www/html/vendor/justbetter/magento2-sentry/Helper/Data.php:320
JustBetter\Sentry\Helper\Data->getStore() at /var/www/html/vendor/justbetter/magento2-sentry/Helper/Data.php:199
JustBetter\Sentry\Helper\Data->getStoreId() at /var/www/html/vendor/justbetter/magento2-sentry/Helper/Data.php:209
JustBetter\Sentry\Helper\Data->collectModuleConfig() at /var/www/html/vendor/justbetter/magento2-sentry/Helper/Data.php:75
JustBetter\Sentry\Helper\Data->__construct() at /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php:108
Magento\Framework\ObjectManager\Factory\Compiled->create() at /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php:150
Magento\Framework\ObjectManager\Factory\Compiled->get() at /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php:79
Magento\Framework\ObjectManager\Factory\Compiled->create() at /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php:73
Magento\Framework\ObjectManager\ObjectManager->get() at /var/www/html/vendor/magento/framework/Logger/LoggerProxy.php:101
Magento\Framework\Logger\LoggerProxy->getLogger() at /var/www/html/vendor/magento/framework/Logger/LoggerProxy.php:140
Magento\Framework\Logger\LoggerProxy->error() at /var/www/html/vendor/magento/framework/Console/Cli.php:121
Magento\Framework\Console\Cli->doRun() at /var/www/html/vendor/symfony/console/Application.php:175
Symfony\Component\Console\Application->run() at /var/www/html/bin/magento:23
I think this bug was introduced with the changes from b4fd7e1
lsiebelslefte and MartinVanVan
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
indykoning commentedon Feb 17, 2025
Hi, i have a similar setup where the env.php does not exist during the compilation step.
Unfortunately though i am unable to reproduce this myself, having successfully deployed multiple sites.
If you find what is causing it for you i'd happily accept a PR!
moston commentedon Mar 3, 2025
@mfickers check your app/etc/config.php if you have proper website's set there - in my case it was duplicated is_default = 1 websites
MartinVanVan commentedon Mar 27, 2025
You can reproduce this by setting your local magento project in production mode and delete (or rename) you env.php.
Then just run
magento setup:di:compile
🐛 fix justbetter#160 compile issue
indykoning commentedon May 6, 2025
If i am to believe #169 this should now be fixed in V4.0.1 🚀
If the issue persists, feel free to reopen the issue
rsanderbasecom commentedon Jun 13, 2025
unfortunately this issue still exists after the changes in V4.0.1. I tested it on V4.2.0 and it is the same error as @mfickers already mentioned. Had to downgrade it to 3.8.0
indykoning commentedon Jun 13, 2025
Could you see and try wether #188 fixes your issue.
It should catch the error that the website is missing, and return null instead which we expect could be the case in other parts of the code
rsanderbasecom commentedon Jun 16, 2025
Thanks for your quick response. I've tested your fix but i still get an error.
This is my Stacktrace:
I think the collectModuleConfig() function is also the problem...
indykoning commentedon Jun 16, 2025
I think you're right, i've updated the PR that should be caught as well now!
Could you give it a try?