Аргумент 1, передаваемый в Illuminate \ Cookie \ Middleware \ EncryptCookies :: encrypt (), должен быть экземпляром Symfony \ Component \ HttpFoundation \ Response - PullRequest
0 голосов
/ 25 апреля 2020

Я создал этот проект в laravel 5.4 и был обновлен до 5.8 после пошаговой официальной документации.

Иногда на производстве я получаю эту ошибку и не могу ее воспроизвести.

Я использую Bugsnag для контроля исключений на производстве.

Это POST do / register, но в Bugsnag показывает, что пользователь вошел в систему, но я искал в моем приложении, и нет никакого способа пользователю сделать запрос / зарегистрироваться, когда он зарегистрирован.

Symfony\Component\Debug\Exception\FatalThrowableError Argument 1 passed to Illuminate\Cookie\Middleware\EncryptCookies::encrypt() must be an instance of Symfony\Component\HttpFoundation\Response, string given, called in vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php on line 66
vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:131 Illuminate\Cookie\Middleware\EncryptCookies::encrypt
vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66 Illuminate\Cookie\Middleware\EncryptCookies::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 Illuminate\Pipeline\Pipeline::then
vendor/laravel/framework/src/Illuminate/Routing/Router.php:682 Illuminate\Routing\Router::runRouteWithinStack
vendor/laravel/framework/src/Illuminate/Routing/Router.php:657 Illuminate\Routing\Router::runRoute
vendor/laravel/framework/src/Illuminate/Routing/Router.php:623 Illuminate\Routing\Router::dispatchToRoute
vendor/laravel/framework/src/Illuminate/Routing/Router.php:612 Illuminate\Routing\Router::dispatch
vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176 Illuminate\Foundation\Http\Kernel::Illuminate\Foundation\Http\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    Http/Middleware/App.php:35 App\Http\Middleware\App::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49 Illuminate\View\Middleware\ShareErrorsFromSession::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:56 Illuminate\Session\Middleware\StartSession::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 Illuminate\Foundation\Http\Middleware\TransformsRequest::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21 Illuminate\Foundation\Http\Middleware\TransformsRequest::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27 Illuminate\Foundation\Http\Middleware\ValidatePostSize::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/fideloper/proxy/src/TrustProxies.php:57 Fideloper\Proxy\TrustProxies::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/barryvdh/laravel-cors/src/HandlePreflight.php:29 Barryvdh\Cors\HandlePreflight::handle
vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53 Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
    vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 Illuminate\Pipeline\Pipeline::then
vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151 Illuminate\Foundation\Http\Kernel::sendRequestThroughRouter
vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116 Illuminate\Foundation\Http\Kernel::handle
public/index.php:46 [main]

Я могу показать больше информации, если это необходимо.

1 Ответ

0 голосов
/ 25 апреля 2020

Вы должны установить protected $headers в App\Http\Middleware\TrustProxies, как показано ниже:

protected $headers = Request::HEADER_X_FORWARDED_ALL;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...