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

Update to Laravel 8.70 breaks postAutoloadDump #39548

Closed
edwinvdpol opened this issue Nov 9, 2021 · 39 comments
Closed

Update to Laravel 8.70 breaks postAutoloadDump #39548

edwinvdpol opened this issue Nov 9, 2021 · 39 comments
Labels

Comments

@edwinvdpol
Copy link

edwinvdpol commented Nov 9, 2021

  • 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
@victorybiz
Copy link

victorybiz commented Nov 9, 2021

I have the same issue with Laravel v8.70.0

@taylorotwell
Copy link
Member

Please share your routes file

@Faks
Copy link

Faks commented Nov 9, 2021

Our development server went down after the update hmm.

@taylorotwell
Copy link
Member

I can't help anyone until you share more information - thanks.

@Faks
Copy link

Faks commented Nov 9, 2021

@taylorotwell
Stack Trace:
[2021-11-09T18:21:04.183951+02:00] RROR: Target class [1\App\Http\Controllers\Api\GameApiController] does not exist. ["ReflectionException: Class "1\App\Http\Controllers\Api\GameApiController" does not exist in /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php:877","Stack trace:","#0 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(877): ReflectionClass->__construct()","#1 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build()","#2 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve()","#3 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve()","#4 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make()","#5 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(276): Illuminate\Foundation\Application->make()","#6 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1069): Illuminate\Routing\Route->getController()","#7 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1012): Illuminate\Routing\Route->controllerMiddleware()","#8 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->gatherMiddleware()","#9 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(688): Illuminate\Routing\Router->gatherRouteMiddleware()","#10 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(672): Illuminate\Routing\Router->runRouteWithinStack()","#11 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute()","#12 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute()","#13 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch()","#14 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()","#15 /home/faks_api_noker/public_html/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#16 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle()","#17 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#18 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()","#19 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()","#20 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#21 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()","#22 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()","#23 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#24 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()","#25 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#26 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()","#27 /home/faks_api_noker/public_html/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#28 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle()","#29 /home/faks_api_noker/public_html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#30 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()","#31 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#32 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then()","#33 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()","#34 /home/faks_api_noker/public_html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle()","#35 {main}","","Next Illuminate\Contracts\Container\BindingResolutionException: Target class [1\App\Http\Controllers\Api\GameApiController] does not exist. in /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php:879","Stack trace:","#0 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build()","#1 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve()","#2 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve()","#3 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make()","#4 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(276): Illuminate\Foundation\Application->make()","#5 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1069): Illuminate\Routing\Route->getController()","#6 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1012): Illuminate\Routing\Route->controllerMiddleware()","#7 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->gatherMiddleware()","#8 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(688): Illuminate\Routing\Router->gatherRouteMiddleware()","#9 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(672): Illuminate\Routing\Router->runRouteWithinStack()","#10 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute()","#11 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute()","#12 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch()","#13 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()","#14 /home/faks_api_noker/public_html/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#15 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle()","#16 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#17 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()","#18 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()","#19 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#20 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()","#21 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()","#22 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#23 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()","#24 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#25 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()","#26 /home/faks_api_noker/public_html/vendor/fruitcake/laravel-cors/src/HandleCors.php(52): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#27 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle()","#28 /home/faks_api_noker/public_html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#29 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle()","#30 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()","#31 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then()","#32 /home/faks_api_noker/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()","#33 /home/faks_api_noker/public_html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle()","#34 {main}"] []

@taylorotwell
Copy link
Member

Nobody has shared a route file yet.

@brunogaspar
Copy link
Contributor

@taylorotwell Seems routes like the following breaks:

Route::get('foo', FooController::class)->name('foo');

@MarioPerini
Copy link

@taylorotwell Seems routes like the following breaks:

Route::get('foo', FooController::class)->name('foo');

Can confirm, this also breaks:
Route::get('/', \App\Http\Livewire\Frontend\Login::class)->name('access.login');

@cage81
Copy link

cage81 commented Nov 9, 2021

Nobody has shared a route file yet.

Same here @taylorotwell. In a new project (Laravel Jetstream/Livewire), the only route I was working on is:

use App\Http\Livewire\Articles;

...

Route::get('/articles', Articles::class)->name('articles');

It worked until few minutes ago (on 8.69.0)

@brunogaspar
Copy link
Contributor

Just saw this on the error above

Target class [1\App\Http\Controllers\Api\GameApiController]

Notice the 1 before the FQCN, something is adding it.

@driesvints
Copy link
Member

@brunogaspar that route works for me in v8.70.0, please post the full routes file.

@Faks
Copy link

Faks commented Nov 9, 2021

hmm been reading merges in latest version, seems maybe withoutMiddleware is breaking it.

@cage81
Copy link

cage81 commented Nov 9, 2021

@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']);

@edwinvdpol edwinvdpol reopened this Nov 9, 2021
@edwinvdpol
Copy link
Author

Sorry, wrong button... @cage81 beat me to the route file.

@taylorotwell
Copy link
Member

Do you actually have a valid action? Does your controller contain an __invoke method?

@bambamboole
Copy link
Contributor

It also happens on laravel/nova routes

@Faks
Copy link

Faks commented Nov 9, 2021

I wonder, how different is RouteServiceProvider for each of us and, does that contributes to that issue.

@driesvints driesvints added the bug label Nov 9, 2021
@cage81
Copy link

cage81 commented Nov 9, 2021

Do you actually have a valid action? Does your controller contain an __invoke method?

Nope...same here, it's a Livewire full page component.

@driesvints
Copy link
Member

@brunogaspar are you using Livewire as well?

@MarioPerini
Copy link

It also happens to livewire full page components which has __invoke from Livewire\Component

@brunogaspar
Copy link
Contributor

@brunogaspar are you using Livewire as well?

@driesvints Not using Livewire and my controller do have __invoke().

I'm trying to understand what caused it to break, based on the changes.

@edwinvdpol
Copy link
Author

I use Laravel actions...

@Faks
Copy link

Faks commented Nov 9, 2021

seems issue is in src/Illuminate/Routing/RouteRegistrar.php

@driesvints
Copy link
Member

driesvints commented Nov 9, 2021

Does it work for anyone if you revert the following two changes? First file is src/Illuminate/Routing/RouteRegistrar.php

Screen Shot 2021-11-09 at 17 43 20

@brunogaspar
Copy link
Contributor

Does it work for anyone if you revert the following two changes? First file is src/Illuminate/Routing/RouteRegistrar.php

Screen Shot 2021-11-09 at 17 43 20

Seems to work for me

@brunogaspar
Copy link
Contributor

return $this->attribute($method, $parameters[0] ?? null);

Also works for me.

@X-Coder264
Copy link
Contributor

X-Coder264 commented Nov 9, 2021

Does it work for anyone if you revert the following two changes? First file is src/Illuminate/Routing/RouteRegistrar.php

@driesvints After reverting these change everything works again.

EDIT: Reverting only the change in RouteRegistrar works for me too.

@driesvints
Copy link
Member

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

@cage81
Copy link

cage81 commented Nov 9, 2021

Does it work for anyone if you revert the following two changes? First file is src/Illuminate/Routing/RouteRegistrar.php

Screen Shot 2021-11-09 at 17 43 20

Yes, it works again reverting back changes.

@taylorotwell
Copy link
Member

Please try these changes and report back if it fixes your problem: 5fda5a3

@brunogaspar
Copy link
Contributor

Please try these changes and report back if it fixes your problem: 5fda5a3

Works for me after those 2 changes.

@X-Coder264
Copy link
Contributor

Please try these changes and report back if it fixes your problem: 5fda5a3

It works for me too with these changes.

@MarioPerini
Copy link

Please try these changes and report back if it fixes your problem: 5fda5a3

Yes works

@Faks
Copy link

Faks commented Nov 9, 2021

fixed, one but broke other hmm.
Invalid route action: [1\Spatie\StripeWebhooks\StripeWebhooksController].

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/api.php:48
Illuminate\Support\Facades\Facade::__callStatic()

  +3 vendor frames 

13 routes/api.php:152
Illuminate\Support\Facades\Facade::__callStatic()

Route - API:
Route::post('stripe-webhooks', StripeWebhooksController::class);

@taylorotwell
Copy link
Member

@Faks will need a smaller reproducible example than that.

@taylorotwell
Copy link
Member

Released 8.70.1.

@Faks
Copy link

Faks commented Nov 9, 2021

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

@taylorotwell
Copy link
Member

Test added to cover this case.

@edwinvdpol
Copy link
Author

Thank you! 👍

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

No branches or pull requests

10 participants