swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.04k stars 390 forks source link

show error Session store not set on request #448

Closed nanwenbo closed 3 years ago

nanwenbo commented 3 years ago

Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)

  1. Please provide your PHP and Swoole version. (php -v and php --ri swoole) php7.2.9 swoole 4.4.16

  2. Please provide your Laravel/Lumen version.

Laravel v5.6

  1. Which release version of this package are you using?

laravel-swoole v2.6.67

  1. What did you do? If possible, provide a recipe for reproducing the error. sometimes laravel show error 'Session store not set on request'.
Arkanius commented 3 years ago

Are you using the "web" middleware in your route?

nanwenbo commented 3 years ago

web

Yes, I used web middleware This error doesn't happen every time I found that if there are several parameter validation errors, it will appear

nanwenbo commented 3 years ago

I solve this problem. When the first request of the swoole initialization process, if the parameter verification error is reported, then the startsession Middleware in middleware groups will not be executed next time, and the startsession will not be re executed in the next request, so the value in the session will not be retrieved. Move the startsession middleware to the middleware group