telescope: Undefined property: Illuminate\Cache\Events\KeyWritten::$seconds
Error Situation:
I have a brand new Laravel 5.7 project in which I have added make:auth. When navigating to /login route the application dies with Whoops reporting this error…
Undefined property: Illuminate\Cache\Events\KeyWritten::$seconds
Thrown at: vendor/laravel/telescope/src/Watchers/CacheWatcher.php line 83
Conclusion
It looks like src/Watchers/CacheWatcher.php
is calling the non existent property ‘seconds’ of the \Illuminate\Cache\Events\KeyWritten
class. Only available properties are ‘key’, ‘value’, ‘tag’, and ‘minutes’.
Telescope::recordCache(IncomingEntry::make([
'type' => 'set',
'key' => $event->key,
'value' => $event->value,
'expiration' => $event->seconds,
]));
My Environment Versions
PHP 7.2.15
Zend Engine v3.2.0 with Xdebug v2.6.1
MySQL Ver 14.14 Distrib 5.7.22
Laravel 5.7.28
Stack Trace
ErrorException thrown with message "Undefined property: Illuminate\Cache\Events\KeyWritten::$seconds"
Stacktrace:
#63 ErrorException in /var/www/vendor/laravel/telescope/src/Watchers/CacheWatcher.php:83
#62 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /var/www/vendor/laravel/telescope/src/Watchers/CacheWatcher.php:83
#61 Laravel\Telescope\Watchers\CacheWatcher:recordKeyWritten in /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:360
#60 Illuminate\Events\Dispatcher:Illuminate\Events\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:209
#59 Illuminate\Events\Dispatcher:dispatch in /var/www/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:497
#58 Illuminate\Cache\Repository:event in /var/www/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:210
#57 Illuminate\Cache\Repository:put in /var/www/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:275
#56 Illuminate\Cache\Repository:add in /var/www/vendor/laravel/framework/src/Illuminate/Cache/RateLimiter.php:60
#55 Illuminate\Cache\RateLimiter:hit in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ThrottlesLogins.php:36
#54 App\Http\Controllers\Auth\LoginController:incrementLoginAttempts in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php:51
#53 App\Http\Controllers\Auth\LoginController:login in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#52 call_user_func_array in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#51 Illuminate\Routing\Controller:callAction in /var/www/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45
#50 Illuminate\Routing\ControllerDispatcher:dispatch in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php:219
#49 Illuminate\Routing\Route:runController in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Route.php:176
#48 Illuminate\Routing\Route:run in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:682
#47 Illuminate\Routing\Router:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#46 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/app/Http/Middleware/RedirectIfAuthenticated.php:24
#45 App\Http\Middleware\RedirectIfAuthenticated:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#43 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41
#42 Illuminate\Routing\Middleware\SubstituteBindings:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#40 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:75
#39 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#37 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49
#36 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#34 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63
#33 Illuminate\Session\Middleware\StartSession:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#31 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
#30 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#29 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#28 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66
#27 Illuminate\Cookie\Middleware\EncryptCookies:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#26 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#25 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#24 Illuminate\Pipeline\Pipeline:then in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:684
#23 Illuminate\Routing\Router:runRouteWithinStack in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:659
#22 Illuminate\Routing\Router:runRoute in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:625
#21 Illuminate\Routing\Router:dispatchToRoute in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Router.php:614
#20 Illuminate\Routing\Router:dispatch in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176
#19 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#18 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/fideloper/proxy/src/TrustProxies.php:57
#17 Fideloper\Proxy\TrustProxies:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#15 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#14 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#12 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#9 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27
#8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#6 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62
#5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163
#4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#3 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#2 Illuminate\Pipeline\Pipeline:then in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151
#1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
#0 Illuminate\Foundation\Http\Kernel:handle in /var/www/public/index.php:55
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 22 (5 by maintainers)
Everyone, please make sure to use Telescope 2.0 on Laravel 5.8, or Telescope 1.0 on Laravel 5.7.
@themsaid When I manually changed my composer.json to ‘>=1.0 <2.0.0’ it installed Telescope v1.1 and worked fine.
Agree with @RicardoRamirezR on mentioning the issue on installing Telescope for Laravel < 5.8 as it may save potential hours of head scratching and debugging for others.
May also want to remove
~5.7.7
from the composer.json file for dev-master since it breaks everything less than 5.8You’ll need to use Laravel 5.8 and Telescope 2.0, 5.8 is released already so if it’s a fresh project then start with it 😃
If anyone wants a very fragile work around until they get a chance to update to 5.8 then this will work
Change
to
Of course if you composer update etc that will remove all the changes and you’re back to square one. As I said very fragile.
@laurencei we tagged a new version!
@themsaid Have similar error
Undefined property: Illuminate\Cache\Events\KeyWritten::$minutes
Laravel 5.8 Telescope 3.0
I’m in 5.7 and then did
composer require laravel/telescope
it installed 2.0 since in telescope composer has"laravel/framework": "~5.7.7|~5.8.0"
and Telescope 2.0 is not compatible with Laravel 5.7