framework: Update to Laravel 8.70 breaks postAutoloadDump

  • Laravel Version: 8.70.0
  • PHP Version: 8.0.10
  • Database Driver & Version: MySQL 8.0.26

Description:

The artisan package discovery command throws an UnexpectedValueException when running postAutoloadDump

Invalid route action: [1\App\Actions\Calendar\CalendarEvents].

I noticed a 1 in front of the class name.

When I specifically set the Laravel framework to v8.69.0 in composer.json and run it again, all works as it should.

Steps To Reproduce:

  • Upgrade from Laravel framework v8.69 to v8.70.
  • sail composer update
Output
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading laravel/framework (v8.69.0 => v8.70.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading laravel/framework (v8.70.0)
  - Upgrading laravel/framework (v8.69.0 => v8.70.0): Extracting archive
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   UnexpectedValueException 

  Invalid route action: [1\App\Actions\Calendar\CalendarEvents].

  at vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php:92
     88▕      */
     89▕     protected static function makeInvokable($action)
     90▕     {
     91▕         if (! method_exists($action, '__invoke')) {
  ➜  92▕             throw new UnexpectedValueException("Invalid route action: [{$action}].");
     93▕         }
     94▕ 
     95▕         return $action.'@__invoke';
     96▕     }

      +8 vendor frames 
  9   routes/web.php:38
      Illuminate\Support\Facades\Facade::__callStatic()

      +3 vendor frames 
  13  routes/web.php:57
      Illuminate\Routing\RouteRegistrar::group()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 39 (21 by maintainers)

Most upvoted comments

Released 8.70.1.

Thanks all. We’re gonna get that fixed. Hold on for now.

Test added to cover this case.

@taylorotwell did update now everything returned to a stable working state.

It also happens on laravel/nova routes

@driesvints

<?php

use Illuminate\Support\Facades\Route;
use App\Http\Livewire\Articles;
use App\Http\Controllers\MailController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return redirect()->route('dashboard');
});

Route::middleware(['auth:sanctum', 'verified'])->group(function () {
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
});

Route::get('/articles', Articles::class)->name('articles');
Route::get('/testmail', [MailController::class, 'index']);