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

Autoloading addon commands causes NotBootedException #10873

Closed
heidkaemper opened this issue Oct 1, 2024 · 0 comments · Fixed by #10875
Closed

Autoloading addon commands causes NotBootedException #10873

heidkaemper opened this issue Oct 1, 2024 · 0 comments · Fixed by #10875
Labels

Comments

@heidkaemper
Copy link
Contributor

heidkaemper commented Oct 1, 2024

Bug description

When trying to use (some) addons with Statamic 5.28.0 we get an NotBootedException. This is caused by the new autoload feature: #9270

The problem may be that we're calling $this->getAddon() here:

$addon = $this->getAddon();

But $this->app->isBooted() isn't true yet, when commands are registered:

throw_unless($this->app->isBooted(), new NotBootedException);

An easy fix would be to disable autoload for commands. But maybe there is a smarter way.

How to reproduce

  1. Install Statamic v5.28.0
  2. Try to install an addon that has commands, like Responsive Images:
    https://statamic.com/addons/spatie/responsive-images

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.25.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: statamic.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.x-dev Solo

Statamic Addons
spatie/statamic-responsive-images: 5.0.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@heidkaemper heidkaemper changed the title Autoloading commands causes NotBootedException Autoloading addon commands causes NotBootedException Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants