Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using with Telescope on a dev-only env #39

Open
Braunson opened this issue Jun 25, 2020 · 6 comments
Open

Error when using with Telescope on a dev-only env #39

Braunson opened this issue Jun 25, 2020 · 6 comments

Comments

@Braunson
Copy link
Contributor

Braunson commented Jun 25, 2020

I've installed Telescope and set it up to only register and be used on the dev environment, no problems there.

The issue is when I install this Toolbar and publish the config, when running composer install on a non-dev env, it throws a Facade error.

Digging into things, the cause is the config references Horizon classes Laravel\Telescope\EntryType in the collectors array in the toolbar config file that's published.

Any ideas on a way around this for a local only environment?

I am only loading Telescope and Toolbar packages on the local environment in AppServiceProvider.php@register

if ($this->app->isLocal()) {
    // Laravel Telescope
    $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
    $this->app->register(TelescopeServiceProvider::class);

    // Laravel Telescope Toolbar
    $this->app->register(\Fruitcake\TelescopeToolbar\ToolbarServiceProvider::class);
}

Error

[2020-06-25 17:32:02] production.ERROR: Class 'Laravel\Telescope\EntryType' not found {"exception":"[object] (Error(code: 0): Class 'Laravel\\Telescope\\EntryType' not found at /home/vagrant/project/config/telescope-toolbar.php:97)
[stacktrace]
#0 /home/vagrant/project/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require()
#1 /home/vagrant/project/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles()
#2 /home/vagrant/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap()
#3 /home/vagrant/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith()
#4 /home/vagrant/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#5 /home/vagrant/project/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#6 {main}
@barryvdh
Copy link
Member

Did you put in in your require-dev section?

@Braunson
Copy link
Contributor Author

Braunson commented Jun 27, 2020

@barryvdh Yes, same with Laravel Horizon which it's config doesn't seem to complain about missing classes.

The only "workaround" to get it not to complain was to remove the published config for the toolbar, but that's not necessarily ideal.

@AndrewFeeney
Copy link

It's a bit hacky, but I was able to workaround this issue, without deleting the published config by adding the following to the top of my config/telescope-toolbar.php file:

<?php

use Laravel\Telescope\EntryType;

// Add this conditional before the existing return statement
if (! class_exists(EntryType::class)) {
    return [];
}

return [
  //  ...
];

@Oxicode
Copy link

Oxicode commented Mar 7, 2021

Thx @AndrewFeeney

@Braunson
Copy link
Contributor Author

@barryvdh Can we expect an official fix for this? I can put in a PR for one..

@fh32000
Copy link

fh32000 commented Sep 26, 2022

any update @Braunson @barryvdh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants