Skip to content

fix: register routes inside Nova::serving to ensure middleware aliases exist#89

Open
milan607 wants to merge 1 commit intobastihilger:masterfrom
milan607:fix/nova-middleware-registration
Open

fix: register routes inside Nova::serving to ensure middleware aliases exist#89
milan607 wants to merge 1 commit intobastihilger:masterfrom
milan607:fix/nova-middleware-registration

Conversation

@milan607
Copy link

@milan607 milan607 commented Feb 9, 2026

Routes were being registered in app->booted() which can run before Nova's middleware aliases (nova) are registered, causing errors when the middleware cannot be found.

Moving route registration inside Nova::serving() ensures Nova is fully bootstrapped before we reference its middleware.

Problem

When the package's service provider boots before Nova's service provider, the nova middleware alias doesn't exist yet, causing route registration to fail.

Solution

Register routes inside Nova::serving() callback instead of app->booted(), ensuring Nova is fully initialized.

Changes

  • Moved $this->routes() call from app->booted() into Nova::serving() callback
  • Added clarifying comment explaining why

…s exist

Routes were being registered in app->booted() which can run before
Nova's middleware aliases (nova) are registered, causing errors when
the middleware cannot be found.

Moving route registration inside Nova::serving() ensures Nova is fully
bootstrapped before we reference its middleware.

Fixes route registration timing issue when Nova's service provider
boots after the package's service provider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant