2

I have a big problem with my laravel application on production mode only...

I don't know when it's firing, but this website is around 10k visitors/day and my laravel log file is so big now..

Here you can find the log :

The payload is invalid. {"exception":"[object] (Illuminate\\Contracts\\Encryption\\DecryptException(code: 0): The payload is invalid. at /home/web/abuk/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:195)
[stacktrace]
#0 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php(136): Illuminate\\Encryption\\Encrypter->getJsonPayload(NULL)
#1 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(154): Illuminate\\Encryption\\Encrypter->decrypt('eyJpdiI6Ik1wN0p...', false)
#2 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(136): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->getTokenFromRequest(Object(Illuminate\\Http\\Request))
#3 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(74): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->tokensMatch(Object(Illuminate\\Http\\Request))
#4 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#5 /home/web/abuk/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#6 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#7 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#8 /home/web/abuk/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))

I really don't know from where it comes..

Samax
  • 33
  • 1
  • 5

3 Answers3

1

Try to clear the cache with the following command:

php artisan cache:clear

Dont forget to include the csrf in your forms https://laravel.com/docs/6.x/csrf

Nuno Alex
  • 116
  • 3
  • I think that it solved the problem using php artisan cache:clear ... Why? – Samax Jan 04 '20 at 16:09
  • I'm not sure, laravel caches some configurations on your local environment and when we move our applications to the production those configurations still there so it is important to clear the cache. (just my opinion). – Nuno Alex Jan 05 '20 at 12:14
0

Please try this: 1- php artisan clear; or 2- make sure you application generated APP_KEY, if not do php artisan key: generate 3- if you are using Jwt make sure JWT_SECRET was generated, if not do php artisan jwt:secret

0

May be you frogot _token in the form @csrf

Rohit Bhalani
  • 133
  • 1
  • 5
  • 14