Laravel 5 randomly sends 500 internal server errors to ajax requests

In my application, Laravel 5 randomly sends 500 internal server errors to ajax requests (for example, for ten 200 OK requests, one 500 Internal Server Error request). The CSRF icon is configured correctly:

$(function() { $.ajaxSetup({ timeout: 3000, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); }); 

Here's what Laravel says

enter image description here

How can I fix this or catch the place in the code where the problem is?

+6
source share
1 answer

Random Ajax request errors mostly cause configuration problems. Check your log laravel storage -> logs -> laravel.log , which is causing the problem.

You can cache your configs by running the artisan command. It will get rid of a random error popup.

 php artisan config:cache 
+2
source

All Articles