Jwt-auth: CacheManager dependency resolving error

Created on 12 Jul 2015  路  12Comments  路  Source: tymondesigns/jwt-auth

On the dev branch I am getting the following error:
Unresolvable dependency resolving [Parameter #0 [ <required> $app ]] in class Illuminate\Cache\CacheManager

in Container.php line 823
at Container->resolveNonClass(object(ReflectionParameter)) in Container.php line 798
at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 771
at Container->build('Illuminate\Cache\CacheManager', array()) in Container.php line 626
at Container->make('Illuminate\Cache\CacheManager', array()) in Application.php line 393
at Application->make('Illuminate\Cache\CacheManager') in Container.php line 837
at Container->resolveClass(object(ReflectionParameter)) in Container.php line 800
at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 771
at Container->build('Tymon\JWTAuth\Providers\Storage\Illuminate', array()) in Container.php line 626
at Container->make('Tymon\JWTAuth\Providers\Storage\Illuminate', array()) in Application.php line 393
at Application->make('Tymon\JWTAuth\Providers\Storage\Illuminate') in LumenServiceProvider.php line 207
at LumenServiceProvider->getConfigInstance('providers.storage') in LumenServiceProvider.php line 88
at LumenServiceProvider->Tymon\JWTAuth\Providers\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('tymon.jwt.provider.storage', array()) in Application.php line 393
at Application->make('tymon.jwt.provider.storage') in Container.php line 1157
at Container->offsetGet('tymon.jwt.provider.storage') in LumenServiceProvider.php line 139
at LumenServiceProvider->Tymon\JWTAuth\Providers\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('tymon.jwt.blacklist', array()) in Application.php line 393
at Application->make('tymon.jwt.blacklist') in Container.php line 1157
at Container->offsetGet('tymon.jwt.blacklist') in LumenServiceProvider.php line 101
at LumenServiceProvider->Tymon\JWTAuth\Providers\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('tymon.jwt.manager', array()) in Application.php line 393
at Application->make('tymon.jwt.manager') in Container.php line 1157
at Container->offsetGet('tymon.jwt.manager') in LumenServiceProvider.php line 126
at LumenServiceProvider->Tymon\JWTAuth\Providers\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('tymon.jwt.auth', array()) in Application.php line 393
at Application->make('tymon.jwt.auth', array()) in helpers.php line 38
at app('tymon.jwt.auth') in AuthController.php line 49
at AuthController->postLogin(object(Request))
at call_user_func_array(array(object(AuthController), 'postLogin'), array(object(Request))) in Container.php line 502
at Container->call(array(object(AuthController), 'postLogin'), array()) in Application.php line 1328
at Application->callControllerCallable(array(object(AuthController), 'postLogin'), array()) in Application.php line 1293
at Application->callLumenController(object(AuthController), 'postLogin', array(true, array('uses' => 'App\Http\Controllers\Auth\AuthController@postLogin'), array())) in Application.php line 1264
at Application->callControllerAction(array(true, array('uses' => 'App\Http\Controllers\Auth\AuthController@postLogin'), array())) in Application.php line 1232
at Application->callActionOnArrayBasedRoute(array(true, array('uses' => 'App\Http\Controllers\Auth\AuthController@postLogin'), array())) in Application.php line 1217
at Application->handleFoundRoute(array(true, array('uses' => 'App\Http\Controllers\Auth\AuthController@postLogin'), array())) in Application.php line 1138
at Application->Laravel\Lumen\{closure}() in Application.php line 1370
at Application->sendThroughPipeline(array(), object(Closure)) in Application.php line 1144
at Application->dispatch(null) in Application.php line 1084
at Application->run() in index.php line 28

Most helpful comment

a quick fix for Lumen:
in app/config.php add:

$app->alias('cache', 'Illuminate\Cache\CacheManager');
$app->alias('auth', 'Illuminate\Auth\AuthManager');

All 12 comments

This happens in Lumen environment only. It runs fine in laravel environment

You will need to add caching support to lumen (via illuminate/cache)

Not required, lumen already depends on it.
Quick fix was

protected function registerStorageProvider()
    {
        $this->app->singleton('tymon.jwt.provider.storage', function ($app) {
            $provider = $this->config('providers.storage');

            return $app->make($provider, [new CacheManager($app)]);
//            return $this->getConfigInstance('providers.storage');
        });
    }

Oh I see.. Haven't played around much with lumen tbh

Hi, I'm having this issue with a fresh Lumen install and Dingo API. How can I rectify it?

a quick fix for Lumen:
in app/config.php add:

$app->alias('cache', 'Illuminate\Cache\CacheManager');
$app->alias('auth', 'Illuminate\Auth\AuthManager');

+1 @jrmadsen67

+1 @jrmadsen67

why is this closed? I'm still having this issue

I had this problem today too.
@jrmadsen67 your solution worked, thanks! Can you explain what exactly is going on and why that works?

Quick fix for Lumen is in bootstrap/app.php not in app/config.php

+1 @jrmadsen67

Was this page helpful?
0 / 5 - 0 ratings

Related issues

johncloud200 picture johncloud200  路  3Comments

gandra picture gandra  路  3Comments

agneshoving picture agneshoving  路  3Comments

loic-lopez picture loic-lopez  路  3Comments

aofdev picture aofdev  路  3Comments