Bugsnag error when running artisan command - laravel

I got this error when trying to run my php artisan migrate on my production server...
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
I ran env on the command line and I have an env variable called BUGSNAG_API_KEY and the value of it exactly matches the key at bugsnag.com for this project.
Furthermore, I have this line in my project at ./config/bugsnag.php
'api_key' => env('BUGSNAG_API_KEY'),
Weirdly, I eventually tried the same command again (php artisan migrate) and it worked! But it's left me very unsettled as it's a production server. So I'd like to understand the problem.
Errors seem to be logging in Bugsnag as well by the way.

Try to regenerate the configuration cache with php artisan config:cache. It will use the current data from the .env file to generate a new configuration cache. This worked for me.

In case this helps anyone...
The Bugsnag Git Repo mentions this issue:
(Uncaught exception 'ReflectionException' with message 'Class bugsnag.logger does not exist'
Github user GrahamCampbell suggested that what is actually happening is that another error exists, but it's "...trying to log to bugsnag which is causing this error, which is hiding the real error". I confirmed this was my issue by doing what user russianryebread suggested, which was to manually copy the bugsnag.php config file over to the Laravel /config directory. Once I did that now my real error shows:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '{'
Now to troubleshoot this issue :)
Hope this helps!

Related

Laravel logging "Class 'Arr' not found in Command line code:1"

The error below is the stack trace which is being logged to the laravel storage log every minute.
[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 haven't used this anywhere in my controllers or blade templates.
Any help is appreciated.
For anyone receiving this issue, This is actually an issue with a VSCode Laravel's Plugin called laravel-extra-intellisense.
The issue is actually from the plugin's issue as it uses functionality from Laravel 5.8 and above, so if your project uses Laravel's 5.7 and below you can do this to clear the error.
add this line in your config/app.php
'Arr' => Illuminate\Support\Arr::class, dlam config/app.php
and after adding the line, you may received a new error like so
[2020-10-06 05:57:04] 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}
"}
You can solve this one by commenting this line in app\Providers\AuthServiceProvider.php
/**
* The policy mappings for the application.
*
* #var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy', <-- comment this line
];
All of these changes is already in the lastest Laravel (version 5.8 and above)
I think this happens because the plugin's logger handler isn't working so that is why it logs in your laravel's project. So until it is fixed, please do the above or upgrade your laravel.
You can check this issue in the plugin's github
I appreciate the help but I solved this by uninstalling and reinstalling valet.
Makes no sense but thankfully the errors are gone.
Sean

How to check where is this error on laravel [duplicate]

This question already has answers here:
How to set up file permissions for Laravel?
(21 answers)
Closed 2 years ago.
Hi there i have an error on laravel but i don't know where is, this error make me website on error 404 , with another error HTTP 500
[26-Feb-2019 18:10:48 UTC] PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php:181
Stack trace:
#0 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/home2/website...', Array)
#1 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get('/home2/website...', Array)
#2 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(125): Illuminate\View\View->getContents()
#3 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(90): Illuminate\View\View->renderContents()
#4 /home2/website/website.com/storage/framework/views/e5516c2faf25e2e2a432f5486f5485d6792013e9.php(53): Illuminate\View\View->render()
#5 /home2/website/website.com/vendo in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php on line 181
[26-Feb-2019 18:10:48 UTC] PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php:181
Stack trace:
#0 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('/home2/website...', Array)
#1 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get('/home2/website...', Array)
#2 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(125): Illuminate\View\View->getContents()
#3 /home2/website/website.com/vendor/laravel/framework/src/Illuminate/View/View.php(90): Illuminate\View\View->renderContents()
#4 /home2/website/website.com/storage/framework/views/e5516c2faf25e2e2a432f5486f5485d6792013e9.php(53): Illuminate\View\View->render()
#5 /home2/website/website.com/vendo in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php on line 181
Just read the error that's beside the date posted.
HP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php:181
So in one of the views that's generated, there is an unexpected endif on line 181.
This file: 6a75bc263740fca85e4609e4affe4f57142c2c3a.php is the one that's generated, you'll have to look into this file in the storage/framework/views/ folder. From there, you can figure out the actual view (in your resources folder) that it's created from. The real problem will be there.
Just read the first line of the error log [26-Feb-2019 18:10:48 UTC] PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in /home2/website/website.com/storage/framework/views/6a75bc263740fca85e4609e4affe4f57142c2c3a.php:181
.
Seems that you forgot to put an #endif directive on the view you're trying to access.
For more, read here: Control Structures
Add Bugsnag to your application to automatically detect handled and unhandled Laravel errors.
Bugsnag integration Laravel guide

Laravel example project on PhpStorm is not compileable

I am very new to using Frameworks/Laravel and I haven't achieved to run the Laravel welcome website in PhpStorm yet.
Steps I've done so far:
I have created a new "Composer Project" with PhpStorm and chose Laravel as Package.
I installed the IDE helper in line with this tutorial: http://blog.jetbrains.com/phpstorm/2015/01/laravel-development-using-phpstorm/
I installed XAMPP and started the Apache server on port 8000
Changed the PhpStorm Settings -> Language & Frameworks -> PHP -> Interpreter -> Path to php.exe inside of XAMPP
I tried to watch the results in a browser by clicking "Run". A PHP fatal error appeared in the debugger which said the class TestCase couldn't be found.
After googling I added the phpunit.xml as an alternative configuration file for my Run/Debug configurations. Furthermore I read that I need to add the "tests" folder inside of my project directory as "Directory Test Scope" there.
The debugger says "All Tests passed", but I am receiving a different fatal error which I wasn't able to solve until now:
Fatal error: Call to undefined method
PHPUnit_Framework_TestResult::deprecatedFeaturesCount() in
C:\xampp\php\pear\PHPUnit\TextUI\ResultPrinter.php on line 446
Fatal error: Uncaught exception
'Illuminate\Contracts\Container\BindingResolutionException' with
message 'Target [Illuminate\Contracts\Debug\ExceptionHandler] is not
instantiable.' in C:\Users\kentor\PhpstormProjects\test
Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:752
Stack trace:
0 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(633):
Illuminate\Container\Container->build('Illuminate\Cont...', Array)
#1 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697):
Illuminate\Container\Container->make('Illuminate\Cont...', Array)
#2 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(154):
Illuminate\Foundation\Application->make('Illuminate\Cont...')
#3 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(79):
in C:\Users\kentor\PhpstormProjects\test
Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php
on line 752 PHP
Fatal error: Call to undefined method
PHPUnit_Framework_TestResult::deprecatedFeaturesCount() in
C:\xampp\php\pear\PHPUnit\TextUI\ResultPrinter.php on line 446 PHP
Fatal error: Uncaught exception
'Illuminate\Contracts\Container\BindingResolutionException' with
message 'Target [Illuminate\Contracts\Debug\ExceptionHandler] is not
instantiable.' in C:\Users\kentor\PhpstormProjects\test
Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php:752
Stack trace:
#0 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(633):
Illuminate\Container\Container->build('Illuminate\Cont...', Array)
#1 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697):
Illuminate\Container\Container->make('Illuminate\Cont...', Array)
#2 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(154):
Illuminate\Foundation\Application->make('Illuminate\Cont...')
#3 C:\Users\kentor\PhpstormProjects\test Laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(79):
in C:\Users\kentor\PhpstormProjects\test
Laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php
on line 752
Process finished with exit code 255
So in the end I want to see the contents of my "Public" folder.
My questions:
Why did I need to specify the "tests" folder? Is this used for verifying that PHP is compiling correctly or any similar testing stuff?
What did I miss in order to see my Laravel example page in the end?

Blank white page when finished uploading files to server laravel5

I have finished uploading files to server inside demo folder, but when i visited i got blank white page. when i visited somedomain.com/demo i got blank white page. Can anyone help me please. My folder directory start with demo. Inside demofolder i have app,bootstrap,config etc folders.
when i view storage/log file i got
[2015-09-20 06:38:00] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:52:16] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:53:23] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
[2015-09-20 06:58:28] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()' in C:\xampp\htdocs\sidinsu\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ClearCompiledCommand.php:28
Stack trace:
#0 {main}
The blank page suggests a 500 error and your logs back this up.
Looking at your logs it is an issue with the vendor/compiled.php file.
Just delete this file, run composer update, and then php artisan optimize after the update to rebuild compiled.php.
On a side note, the URL to view this should be somedomain.com/demo/public as this is where the index.php file is located - unless you have already dealt to this.
When you move Laravel 5 to a production server please do the following:
Change permissions of storage and bootstrap folders to 0755 or 0777 chmod -R 0777 storage/
composer install
composer update
artisan cache:clear
This will resolve your dependencies and make laravel functional.
When you get packages conflicts after doing the above steps remove the packages from app/config/app.php and delete their folders from vendor and run composer update.
Also make sure you will meet Laravel 5 minimum requirements. PHP 5.5.9 is required.

Joomla - Uncaught exception, Error 500 - less block

I've migrated a Joomla site to a new server, updated the configuration.php file, and I'm getting these errors:
Fatal error: Uncaught exception 'RuntimeException' with message 'Less Parse Error: parse error: unclosed block' in
/var/www/websites/alwaysevolving/libraries/gantry/core/gantry.class.php:1141 Stack trace: #0
/var/www/websites/alwaysevolving/templates/rt_cerulean/features/styledeclaration.php(45): Gantry->addLess('mediaqueries.le...') #1
/var/www/websites/alwaysevolving/libraries/gantry/core/gantry.class.php(415): GantryFeatureStyleDeclaration->init() #2
/var/www/websites/alwaysevolving/libraries/gantry/gantry.php(289): Gantry->initTemplate() #3
/var/www/websites/alwaysevolving/libraries/gantry/gantry.php(439): gantry_template_initialize() #4
/var/www/websites/alwaysevolving/templates/rt_cerulean/lib/gantry/gantry.php(21): include('/var/www/websit...') #5
/var/www/websites/alwaysevolving/templates/rt_cerulean/index.php(15): require_once('/var/www/websit...') #6
/var/www/websites/alwaysevolving/libraries/joomla/document/html/html.php(531): require('/var/www/websit...') #7
/var/www/websites/alwaysevolving/libraries/joomla/do in /var/www/websites/alwaysevolving/libraries/gantry/core/gantry.class.php on line 1141
It looks like there's a problem parsing one of the less files, but:
I can't tell which one of the less files has the issue
The less files were fine on the other server
The site seems fine, so it seems like something in this template doesn't like my new server.
Thoughts??
Thanks!
The error message is a stack trace, but looking at it, it appears that the Gantry framework parsing the less file called mediaqueries.less.
I strongly believe that you have forgetten to close braces }. make sure to check the line number will help you resolve the issue.

Resources