Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3.9]: Plugin Store not loading if there is no .env file #12687

Closed
iwfweb opened this issue Feb 16, 2023 · 2 comments
Closed

[4.3.9]: Plugin Store not loading if there is no .env file #12687

iwfweb opened this issue Feb 16, 2023 · 2 comments
Assignees

Comments

@iwfweb
Copy link

iwfweb commented Feb 16, 2023

What happened?

The Plugin Store in the CP is not loading if there is no .env file and the following error is thrown in the web.log

stack trace:
2023-02-16 14:55:28 [web.ERROR] [yii\base\Exception] No .env file exists at /app/.env
#0 /app/vendor/craftcms/cms/src/services/Plugins.php(1178): craft\\services\\Config->setDotEnvVar('PLUGIN_LICENSE_...', 'XXXXXXX...')
#1 /app/vendor/craftcms/cms/src/helpers/Api.php(171): craft\\services\\Plugins->setPluginLicenseKey('blitz', 'XXXXXXX...')
#2 /app/vendor/craftcms/cms/src/controllers/AppController.php(106): craft\\helpers\\Api::processResponseHeaders(Array)
#3 [internal function]: craft\\controllers\\AppController->actionProcessApiResponseHeaders()
#4 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)
#6 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('process-api-res...', Array)
#7 /app/vendor/craftcms/cms/src/web/Application.php(301): yii\\base\\Module->runAction('app/process-api...', Array)
#8 /app/vendor/craftcms/cms/src/web/Application.php(625): craft\\web\\Application->runAction('app/process-api...', Array)
#9 /app/vendor/craftcms/cms/src/web/Application.php(280): craft\\web\\Application->_processActionRequest(Object(craft\\web\\Request))
#10 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest(Object(craft\\web\\Request))
#11 /app/web/index.php(12): yii\\base\\Application->run()

yii\\base\\Exception(code: 0): No .env file exists at /app/.env at /app/vendor/craftcms/cms/src/services/Config.php:352

Expected behavior

Plugin store loading / Craft using the provided docker env vars for plugin licenses/variables instead of a .env file

Actual behavior

"The Plugin Store is not available, please try again later." Error is shown in the Craft CP Plugin Store Tab.
As soon as the .env file is created, the store loads properly.

Craft CMS version

4.3.9

PHP version

8.1

Operating system and version

vagrant bento/debian-11

Database type and version

mysql 8.0

Image driver and version

No response

Installed plugins and versions

  • blitz 4.3.3
  • blitz recommendations 2.1.1
  • formie 2.0.22
  • linkit 4.0.4.1
  • retour 4.1.10
  • seomatic 4.0.20
@iwfweb iwfweb changed the title [4.x]: Plugin Store not loading if there is no .env file [4.3.9]: Plugin Store not loading if there is no .env file Feb 16, 2023
@i-just i-just self-assigned this Feb 17, 2023
@i-just
Copy link
Contributor

i-just commented Feb 17, 2023

Hi, thanks for getting in touch. I can replicate it in the following way:

  • have a clean installation of Craft 4,
  • move all the env variables from the .env file to the ddev configuration
  • install a commercial plugin (e.g. blitz), e.g. via the plugin store
  • go to /<cpTrigger>/settings/plugins, copy the license key and set up an environment variable for it, e.g. PLUGIN_LICENSE_KEY_PLUGIN1=XXXXXXX
  • go to /<cpTrigger>/settings/plugins and use $PLUGIN_LICENSE_KEY_PLUGIN1 as the license key for that plugin
  • you should still be able to visit the plugin store after this change
  • change the PLUGIN_LICENSE_KEY_PLUGIN1 variable to an empty string
  • try visiting the Plugin Store again - the error you describe should get triggered

It looks to be a side effect of fixing this: #11830.

We’ll discuss it internally. I've raised a PR to adjust this behaviour.

@brandonkelly
Copy link
Member

Craft 3.7.67 and 4.3.10 are out with the fix for this, via #12692.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants