ThePatrykOOO
ThePatrykOOO

Reputation: 23

Laravel 500 (Internal Server Error) sometimes

Once every few refreshes of the page I get error 500 which does not allow me to get data from the Laravel API. This response:

{ "message": "Server Error" }{ "message": "Server Error" }

web.php

Route::get('/product/{product}/details', 'ShopController@getProductDetails');

header request

headers: {
                "X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').getAttribute('content')
            },

axios

axios.get(this.$apiClient + '/product/' + this.itemprop + '/details', this.headers)
   .then(response => {
//some code
});

Upvotes: 1

Views: 3023

Answers (2)

Hazzaz Bin Faiz
Hazzaz Bin Faiz

Reputation: 33

I had that issue too. In log file, sometimes it appears.

Access denied for user 'forge'@'localhost' (using password: NO)

To fix this, cache the config or change the default value of database and username at config/database.php.

Upvotes: 1

AlexR1712
AlexR1712

Reputation: 59

You can review the logs in storage/logs to see what is happening

Upvotes: 0

Related Questions