No entry or class found for 'MongoProxy.InsertOne'

Open
#59 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
mongodb, php
Domain
backend, database

Research direction

Start with the reported MongoProxy.InsertOne failure and trace the container lookup at vendor/hyperf/di/src/Container.php:79 through SocketIPCReceiver.php lines 130 and 85. Reproduce the error after the application has run for some time, then compare it with the provided insertOne method. Done means the recurring lookup failure is understood and the Mongo insert path no longer produces this exception.

Written by the indexing model from the issue text.

Description

运行一段时间后,报错 ,hyperf 版本是2.2最新版本
log.ERROR: Insert Document hybrid error 'Hyperf\Di\Exception\NotFoundException: No entry or class found for 'MongoProxy.InsertOne'(0) in /app/web/accept/vendor/hyperf/di/src/Container.php:79
Stack trace:
#0 /app/web/accept/vendor/hyperf/di/src/Container.php(127): Hyperf\Di\Container->make()
#1 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(130): Hyperf\Di\Container->get()
#2 /app/web/accept/vendor/hyperf/gotask/src/IPC/SocketIPCReceiver.php(85): Hyperf\GoTask\IPC\SocketIPCReceiver->dispatch()
#3 {main}' on 'Hyperf\GoTask\Relay\CoroutineSocketRelay'

    public function __construct(ContainerInterface $container,MongoClient $client)
    {
        $this->container = $container;
        $this->logger =$container->get(LoggerFactory::class)->get("log");
        $this->database = $client->database('test');
    }

    public function insertOne(string $collect,array $data)
    {
        try{
            return $this->database->collection($collect)->insertOne($data);
        }catch (\Throwable $e){
            $this->logger->error("Insert Document {$collect} ".$e->getMessage());
        }
        return null;
    }
Dominant language
PHP
Stars
255
Forks
29
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyperf/gotask

All issues in hyperf/gotask

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.