Skip to content

Hyperf\Context\RequestContext::get(): Return value issue #73

@foremtehan

Description

@foremtehan

PHP Version

8.4

Swoole Extension Version

6.0.2

Database Driver & Version

No response

Description

[2025-05-02 14:59:42 *403.0]  channel is destroyed, 1 consumers will be discarded
[2025-05-02 14:59:42 *403.0] Fatal error: Uncaught TypeError: Hyperf\Context\RequestContext::get(): Return value must be of type Swow\Psr7\Message\ServerRequestPlusInterface, null returned in /var/www/html/vendor/hyperf/context/src/RequestContext.php:23
Stack trace:
#0 /var/www/html/vendor/hyperf/http-server/src/Request.php(604): Hyperf\Context\RequestContext::get()
#1 /var/www/html/vendor/hyperf/http-server/src/Request.php(595): Hyperf\HttpServer\Request->getRequest()
#2 /var/www/html/vendor/hyperf/http-server/src/Request.php(391): Hyperf\HttpServer\Request->call()
#3 /var/www/html/app/Exceptions/TelegramLogHandler.php(19): Hyperf\HttpServer\Request->getBody()
#4 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php(250): App\Exceptions\TelegramLogHandler->sendCurl()
#5 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php(235): Monolog\Handler\TelegramBotHandler->send()
#6 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(44): Monolog\Handler\TelegramBotHandler->write()
#7 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(391): Monolog\Handler\AbstractProcessingHandler->handle()
#8 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(646): Monolog\Logger->addRecord()
#9 /var/www/html/vendor/hypervel/log/src/Logger.php(138): Monolog\Logger->error()
#10 /var/www/html/vendor/hypervel/log/src/Logger.php(65): Hypervel\Log\Logger->writeLog()
#11 /var/www/html/vendor/hypervel/log/src/LogManager.php(588): Hypervel\Log\Logger->error()
#12 /var/www/html/vendor/hypervel/foundation/src/Exceptions/Handler.php(311): Hypervel\Log\LogManager->error()
#13 /var/www/html/vendor/hypervel/foundation/src/Exceptions/Handler.php(270): Hypervel\Foundation\Exceptions\Handler->reportThrowable()
#14 /var/www/html/vendor/hypervel/coroutine/src/Coroutine.php(26): Hypervel\Foundation\Exceptions\Handler->report()
#15 /var/www/html/vendor/hyperf/coroutine/src/Coroutine.php(82): Hypervel\Coroutine\Coroutine::printLog()
#16 [internal function]: Hyperf\Coroutine\Coroutine::{closure:Hyperf\Coroutine\Coroutine::create():78}()
#17 {main}
  thrown in /var/www/html/vendor/hyperf/context/src/RequestContext.php on line 23

Steps To Reproduce

request()->getBody()->getContents();

Metadata

Metadata

Assignees

No one assigned

    Labels

    not enough infoThis discussion lacks demo code, detailed description or reproducible steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions