laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.78k stars 296 forks source link

Artisan::call throw BindingResolutionException Target class [config] does not exist. #930

Closed shahramfdl closed 3 months ago

shahramfdl commented 3 months ago

Octane Version

2.5.2

Laravel Version

10.48.16

PHP Version

8.3.9

What server type are you using?

Swoole

Server Version

5.1.3

Database Driver & Version

No response

Description

i have execute an Artisan command from a route. The first api call is successful but after that I get an error message.

{
    "class": "Illuminate\\Contracts\\Container\\BindingResolutionException",
    "message": "Target class [config] does not exist.",
    "code": 0,
    "file": "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:914",
    "trace": [
        "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:795",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:961",
        "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:731",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:946",
        "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:1454",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:243",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:201",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:184",
        "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:458",
        "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:286",
        "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:266",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:217",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:596",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:542",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:465",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:443",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:389",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:176",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:137",
        "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:120",
        "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36",
        "/application/vendor/laravel/framework/src/Illuminate/Container/Util.php:41",
        "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93",
        "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35",
        "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:662",
        "/application/vendor/laravel/framework/src/Illuminate/Console/Command.php:211",
        "/application/vendor/symfony/console/Command/Command.php:326",
        "/application/vendor/laravel/framework/src/Illuminate/Console/Command.php:180",
        "/application/vendor/symfony/console/Application.php:1096",
        "/application/vendor/symfony/console/Application.php:324",
        "/application/vendor/symfony/console/Application.php:175",
        "/application/vendor/laravel/framework/src/Illuminate/Console/Application.php:162",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:400",
        "/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:355",
        "/application/routes/web.php:39",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/CallableDispatcher.php:40",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php:237",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php:208",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:806",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:805",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:784",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:748",
        "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:737",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:200",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:99",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
        "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175",
        "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144",
        "/application/vendor/laravel/octane/src/ApplicationGateway.php:36",
        "/application/vendor/laravel/octane/src/Worker.php:84",
        "/application/vendor/laravel/octane/bin/swoole-server:120",
        "/application/vendor/laravel/octane/bin/swoole-server:170"
    ],
    "previous": {
        "class": "ReflectionException",
        "message": "Class \"config\" does not exist",
        "code": -1,
        "file": "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:912",
        "trace": [
            "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:912",
            "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:795",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:961",
            "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:731",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:946",
            "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:1454",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:243",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:201",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:184",
            "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:458",
            "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:286",
            "/application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:266",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:217",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:596",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:542",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:465",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:443",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:389",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:176",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:137",
            "/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:120",
            "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36",
            "/application/vendor/laravel/framework/src/Illuminate/Container/Util.php:41",
            "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93",
            "/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35",
            "/application/vendor/laravel/framework/src/Illuminate/Container/Container.php:662",
            "/application/vendor/laravel/framework/src/Illuminate/Console/Command.php:211",
            "/application/vendor/symfony/console/Command/Command.php:326",
            "/application/vendor/laravel/framework/src/Illuminate/Console/Command.php:180",
            "/application/vendor/symfony/console/Application.php:1096",
            "/application/vendor/symfony/console/Application.php:324",
            "/application/vendor/symfony/console/Application.php:175",
            "/application/vendor/laravel/framework/src/Illuminate/Console/Application.php:162",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:400",
            "/application/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:355",
            "/application/routes/web.php:39",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/CallableDispatcher.php:40",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php:237",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Route.php:208",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:806",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:805",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:784",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:748",
            "/application/vendor/laravel/framework/src/Illuminate/Routing/Router.php:737",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:200",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php:31",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php:40",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:99",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php:49",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php:39",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:183",
            "/application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:175",
            "/application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:144",
            "/application/vendor/laravel/octane/src/ApplicationGateway.php:36",
            "/application/vendor/laravel/octane/src/Worker.php:84",
            "/application/vendor/laravel/octane/bin/swoole-server:120",
            "/application/vendor/laravel/octane/bin/swoole-server:170"
        ]
    }
}

Steps To Reproduce

Web Route:

Route::get('/test', function () {
    TestJob::dispatch();

    Artisan::call('queue:work', [
        'connection' => 'rabbitmq',
        '--queue' => 'test',
        '--tries' => 1,
        '--stop-when-empty' => 1,
    ]);

    return Artisan::output();
});
driesvints commented 3 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.