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

[v11] Spark middleware does not exist #50298

Closed
pxpm opened this issue Feb 28, 2024 · 4 comments
Closed

[v11] Spark middleware does not exist #50298

pxpm opened this issue Feb 28, 2024 · 4 comments

Comments

@pxpm
Copy link
Contributor

pxpm commented Feb 28, 2024

Laravel Version

11

PHP Version

8.2

Database Driver & Version

sqlite

Description

local.ERROR: Uncaught ReflectionException: Class "Spark\Http\Middleware\VerifyBillableIsSubscribed" does not exist in Command line code:1
Stack trace:
  thrown {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Uncaught ReflectionException: Class \"Spark\\Http\\Middleware\\VerifyBillableIsSubscribed\" does not exist in Command line code:1
"} 

The middleware is referenced here:

'subscribed' => \Spark\Http\Middleware\VerifyBillableIsSubscribed::class,

I am not sure about the fix, or if there is something to fix other than removing that alias.
If it were to fix, maybe checking if the class exists before pushing it to router in

protected function syncMiddlewareToRouter()
? 🤷

Cheers

Steps To Reproduce

just a fresh laravel instalation with: composer create-project laravel/laravel:"dev-master" laravel11

@pxpm pxpm changed the title Spark middleware does not exist [v11] Spark middleware does not exist Feb 28, 2024
@jbrooksuk
Copy link
Member

You need to install Laravel Spark before you may use the middleware.

@pxpm
Copy link
Contributor Author

pxpm commented Feb 28, 2024

@jbrooksuk maybe I am missing something, and sorry if that's the case. But is Spark now a Laravel dependency ?

I just created a new Laravel application using the above mentioned command: composer create-project laravel/laravel:"dev-master" laravel11

Care to re-open or please clarify? This spark alias came with the framework.

Thanks in advance. 🙏

@crynobone
Copy link
Member

CleanShot 2024-02-29 at 08 39 21

Unable to replicate the issue with just composer create-project laravel/laravel:"dev-master" laravel11

@pxpm
Copy link
Contributor Author

pxpm commented Feb 29, 2024

CleanShot 2024-02-29 at 08 39 21

Unable to replicate the issue with just composer create-project laravel/laravel:"dev-master" laravel11

Thanks for your time @crynobone

I've updated #50304 (comment) with my findings.

It's the VSCode PHP Intellisense (static analysis) that wrote those errors on my log file when indexing project files.

image

While on this process, the error pops up in the logs.

To reproduce it, you just need to force your editor to re-index project files.

What annoys me is that I spent quite some time trying to debug this thing, I just saw it on my laravel.log file. No complete stacktrace, no way to reproduce it.

And the solution is to move the alias registration to spark package. I don't get the "convenience" in this case because you need to install spark anyway to use it. So why not have the alias when you install spark and remove it from framework code?

Cheers

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

No branches or pull requests

3 participants