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

🐞 Local server = crash on start #11

Open
rtrudel opened this issue Oct 21, 2019 · 2 comments
Open

🐞 Local server = crash on start #11

rtrudel opened this issue Oct 21, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@rtrudel
Copy link

rtrudel commented Oct 21, 2019

Describe the bug
When I re-serve my Craft app, I get this error:

$ ./craft serve 
Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: craft\console\Request::headers'

in /path/to/craft/vendor/yiisoft/yii2/base/Component.php:154

Stack trace:
#0 /path/to/craft/vendor/edenspiekermann/craft-jwt-auth/src/services/JWT.php(40): yii\base\Component->__get('headers')
#1 /path/to/craft/vendor/edenspiekermann/craft-jwt-auth/src/CraftJwtAuth.php(62): edenspiekermann\craftjwtauth\services\JWT->getJWTFromRequest()
#2 [internal function]: edenspiekermann\craftjwtauth\CraftJwtAuth->edenspiekermann\craftjwtauth\{closure}(Object(yii\base\Event))
#3 /path/to/craft/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(yii\base\Event))
#4 /path/to/craft/vendor/craftcms/cms/src/base/ApplicationTrait.php(1360): yii\base\Component->trigger('init')
#5 /path/to/craft/vendor/craftcms/cms/src/console/Application.php(65): craft\console\Application->_postInit()
#6 /path/to/craft/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#7 /path/to/craft/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#8 /path/to/craft/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#9 /path/to/craft/vendor/craftcms/cms/src/console/Application.php(54): yii\console\Application->__construct(Array)
#10 [internal function]: craft\console\Application->__construct(Array)
#11 /path/to/craft/vendor/yiisoft/yii2/di/Container.php(384): ReflectionClass->newInstanceArgs(Array)
#12 /path/to/craft/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\console\\A...', Array, Array)
#13 /path/to/craft/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\console\\A...', Array, Array)
#14 /path/to/craft/vendor/craftcms/cms/bootstrap/bootstrap.php(244): yii\BaseYii::createObject(Array)
#15 /path/to/craft/vendor/craftcms/cms/bootstrap/console.php(34): require('/Volumes/BLUE/P...')
#16 /path/to/craft/craft(21): require('/Volumes/BLUE/P...')
#17 {main}

To Reproduce
Steps to reproduce the behavior:

  1. Local serve (./craft serve)
  2. Go on Plugin Store, install the plugin
  3. Works fine (at least for now)
  4. Stop the server (Ctrl+C)
  5. Restart the server (./craft serve)
  6. Get this error. Did not serve...

Expected behavior
Craft running on serve.

Desktop (please complete the following information):

  • OS: MacOS Catalina
  • Craft: 3.3.11 Pro (trial)
  • Other plugins: oEmbed, Redactor, Amazon S3
@rtrudel rtrudel added the bug Something isn't working label Oct 21, 2019
@rtrudel
Copy link
Author

rtrudel commented Oct 22, 2019

I may have found the problem:

I replaced:
Craft::$app->on(Application::EVENT_INIT, function (Event $event) {
with
use yii\base\Event;
...
Event::on(CraftVariable::class, CraftVariable::EVENT_INIT, function(Event $event) {

I believe it's almost the same but it seems to work.

@dustfeather
Copy link

dustfeather commented Apr 28, 2020

Can be avoided if you enclose the event in something like this:
if(Craft::$app instanceof craft\web\Application)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants