itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.69k stars 321 forks source link

Wrong app class on lumen and swoole #601

Closed TimoFrenzel closed 3 weeks ago

TimoFrenzel commented 2 years ago

System: Lumen with swoole

.env:

CLOCKWORK_ENABLE = false
CLOCKWORK_DATABASE_COLLECT_MODELS_RETRIEVED = false
CLOCKWORK_DATABASE_SLOW_THRESHOLD = 50 #null
CLOCKWORK_DATABASE_DETECT_DUPLICATE_QUERIES = true
CLOCKWORK_ROUTES_ENABLED = true
CLOCKWORK_WEB = true
CLOCKWORK_TOOLBAR = false
CLOCKWORK_REQUESTS_SLOW_THRESHOLD = 100
CLOCKWORK_ARTISAN_COLLECT = true
CLOCKWORK_QUEUE_COLLECT = true

app.php $app->register(\Clockwork\Support\Lumen\ClockworkSupport\ClockworkServiceProvider::class);

swoole_http.php

'pre_resolved' => [
        'clockwork', 'clockwork.cache', 'clockwork.storage', 'clockwork.support', 'clockwork.request', 
        'clockwork.authenticator','clockwork.eloquent', 'clockwork.events', 'clockwork.notifications', 
        'clockwork.queue', 'clockwork.redis', 'clockwork.swift','clockwork.views', 'clockwork.xdebug',
        'clockwork.lumen',
    ],

    'instances' => [
       'clockwork', 'clockwork.cache', 'clockwork.storage', 'clockwork.support', 'clockwork.request', 
        'clockwork.authenticator','clockwork.eloquent', 'clockwork.events', 'clockwork.notifications', 
        'clockwork.queue', 'clockwork.redis', 'clockwork.swift','clockwork.views', 'clockwork.xdebug',
        'clockwork.lumen',
    ],

When id replace in vendor/itsgoingd/clockwork/Clockwork/Support/Laravel/ClockworkServiceProvider.php i have no error.

$this->app->singleton('clockwork.support', function ($app) {
        return new ClockworkSupport($app);
});

with

$this->app->singleton('clockwork.support', function ($app) {
        if($app instanceof \Laravel\Lumen\Application === false) {
                return new ClockworkSupport($app);
        }
});

Greetz Timo

itsgoingd commented 2 years ago

Hey, what is the error? We don't support Swoole beyond Laravel Octane unfortunately, if this is Swoole-specific issue.