Plugin error is logged in laravel's log
See original GitHub issueI found 3 issue within the plugin all error is logged in laravel's log
The first issue is :
[2020-09-25 19:51:40] local.ERROR: Uncaught Error: Class 'Arr' not found in Command line code:1
Stack trace:
#0 {main}
thrown {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught Error: Class 'Arr' not found in Command line code:1
Stack trace:
#0 {main}
thrown at Command line code:1)
[stacktrace]
#0 {main}
"}
I dig down and found the caused. It was from file /src/authprovider.ts
on line 55. The caused of it was the usage of Arr::flatten()
. This will cause error for users who don’t have Illuminate\support\Arr
registered as alias.
Second Issue I found is:
After fixing the Arr::flatten()
issue, I got a new error.
[2020-10-06 06:15:03] local.ERROR: Uncaught ReflectionException: Class App\Policies\ModelPolicy does not exist in Command line code:1
Stack trace:
#0 Command line code(1): ReflectionClass->__construct('App\\Policies\\Mo...')
#1 [internal function]: {closure}('App\\Policies\\Mo...', 'App\\Model')
#2 Command line code(1): array_map(Object(Closure), Array, Array)
#3 {main}
thrown {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught ReflectionException: Class App\\Policies\\ModelPolicy does not exist in Command line code:1
Stack trace:
#0 Command line code(1): ReflectionClass->__construct('App\\\\Policies\\\\Mo...')
#1 [internal function]: {closure}('App\\\\Policies\\\\Mo...', 'App\\\\Model')
#2 Command line code(1): array_map(Object(Closure), Array, Array)
#3 {main}
thrown at Command line code:1)
[stacktrace]
#0 {main}
"}
I see that you added a new feature, autocompleting policies. But for people who don’t use policies and actually have a default policy registered when you first installed laravel at \app\AuthServiceProvider.php
will receive this error.
AuthServiceProvider.php
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
for user who don’t use policy and didn’t have the file in that location, that error log will consistently came out. it’s best if you have some kind of handler for this. I find the fix is pretty simple. Just comment the line and it works fine. But I think this should be handled within the plugin itself.
The third issue is :
[2020-10-06 06:31:40] local.ERROR: Uncaught Error: Call to undefined method App\Http\Kernel::getRouteMiddleware() in Command line code:1
Stack trace:
#0 {main}
thrown {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught Error: Call to undefined method App\\Http\\Kernel::getRouteMiddleware() in Command line code:1
Stack trace:
#0 {main}
thrown at Command line code:1)
[stacktrace]
#0 {main}
"}
I don’t know much about this one since i didn’t look into it. But it is an issue nonetheless.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:8 (6 by maintainers)
Top GitHub Comments
Hi @ashrafkamarudin
First issue: It’s weird because
Arr
class is an alias class in laravel. https://github.com/laravel/laravel/blob/c66546e75fcbf208d2884b5ac7a3a858137753a3/config/app.php#L194Second issue: About
AuthServiceProvider
, it’s a commented line by default and should not be filled with non-existing class. https://github.com/laravel/laravel/blob/c66546e75fcbf208d2884b5ac7a3a858137753a3/app/Providers/AuthServiceProvider.php#L16Third issue: It’s weird, I used this method to get middleware names. You can see it’s definition here:
https://github.com/laravel/framework/blob/5b756ae90a16ca224ad5283956eca6d3e15aa278/src/Illuminate/Foundation/Http/Kernel.php#L434
Make sure you are using the latest version of laravel in your project.
@mwkcoding Got it.
Contributions are welcome. Please fix this and make a pull request.