question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin error is logged in laravel's log

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
amir9480commented, Oct 8, 2020

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#L194

Second 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#L16

Third 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.

0reactions
amir9480commented, Dec 2, 2020

@mwkcoding Got it.

Contributions are welcome. Please fix this and make a pull request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors & Logging - The PHP Framework For Web Artisans
The logging handler for your application is registered in the app/start/global.php start file. By default, the logger is configured to use a single...
Read more >
How to fix Error: laravel.log could not be opened?
Are you sure you're in the right directory when running that chmod command? Try chmod -R 755 /var/www/laravel/app/storage. · same results (I updated...
Read more >
500 error in Laravel but log folder is empty - Laracasts
@afoysal Start off by checking your config/logging.php configuration, and check to see if you have LOG_CHANNEL defined in your .env file. It's possible...
Read more >
Laravel Logging Tutorial - Stackify
Error log. The location of the error log depends on the web server software you are using, such as nginx or Apache, and...
Read more >
How to Get Started with Logging in Laravel - Better Stack
You need to have the latest version of PHP and Composer installed on your computer. You should also create a new Laravel project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found