JoaquinVilchez's avatar

Problem when try deploy my Laravel app to Heroku

Hi!

Im trying to deploy my Laravel app to Heroku with this guide: https://devcenter.heroku.com/articles/getting-started-with-laravel

But when execute git push heroku master i have this problem in console:

remote:        Generating optimized autoload files
remote:        Deprecation Notice: Class App\restaurant located in ./app/Restaurant.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///tmp/build_bba94d0d/.heroku/php/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
remote:        > Illuminate\Foundation\ComposerScripts::postAutoloadDump
remote:        > @php artisan package:discover --ansi
remote:
remote:        In TelescopeServiceProvider.php line 10:
remote:
remote:          Class 'Laravel\Telescope\TelescopeApplicationServiceProvider' not found
remote:
remote:
remote:        Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
remote:  !     WARNING: There was a class not found error in your code
remote:
remote:  !     ERROR: Dependency installation failed!
remote:  !
remote:  !     The 'composer install' process failed with an error. The cause
remote:  !     may be the download or installation of packages, or a pre- or
remote:  !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')
remote:  !     in your 'composer.json'.
remote:  !
remote:  !     Typical error cases are out-of-date or missing parts of code,
remote:  !     timeouts when making external connections, or memory limits.
remote:  !
remote:  !     Check the above error output closely to determine the cause of
remote:  !     the problem, ensure the code you're pushing is functioning
remote:  !     properly, and that all local changes are committed correctly.
remote:  !
remote:  !     For more information on builds for PHP on Heroku, refer to
remote:  !     https://devcenter.heroku.com/articles/php-support
remote:  !
remote:  !     REMINDER: the following warnings were emitted during the build;
remote:  !     check the details above, as they may be related to this error:
remote:  !     - Your 'composer.lock' is out of date!
remote:  !     - There was a class not found error in your code
remote:
remote:  !     Push rejected, failed to compile PHP app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to pedisimple.
remote:
To https://git.heroku.com/pedisimple.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pedisimple.git'

im tryed to reinstall Telescope and Telescope Toolbar, or remove them because i saw that error, but no have solution...

its my first time to deploy a laravel app to heroku.

if you need some files from my project to detect the problem tell me

PD: In other forums they told me to run php artisan optimize on console, but it also shows me another error that I don't know how to fix. I don't know if it will affect the main problem. This is the error:

 php artisan optimize  
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!

   LogicException 

  Unable to prepare route [api/user] for serialization. Uses Closure.

  at D:\Users\Joaquin\Projects\pedisimple\vendor\laravel\framework\src\Illuminate\Routing\Route.php:1150
    1146|      */
    1147|     public function prepareForSerialization()
    1148|     {
    1149|         if ($this->action['uses'] instanceof Closure) {
  > 1150|             throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
    1151|         }
    1152| 
    1153|         $this->compileRoute();
    1154| 

  1   D:\Users\Joaquin\Projects\pedisimple\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteCacheCommand.php:62
      Illuminate\Routing\Route::prepareForSerialization()

  2   D:\Users\Joaquin\Projects\pedisimple\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:37
      Illuminate\Foundation\Console\RouteCacheCommand::handle()

Thanks

0 likes
3 replies
bobbybouwmann's avatar

Well, it seems the Laravel\Telescope\TelescopeApplicationServiceProvider is still registered in the config/app.php file or it's not properly installed. Make sure you remove all links to the package, so in code and in your composer.json file.

JoaquinVilchez's avatar

@bobbybouwmann I did it! but I kept getting the same error. It also shows me the error in TelescopeApplicationServiceProvider but in config / app.php I can't find one that says exactly like this, but only TelescopeServiceProvider appears.

Can't deploy with Telescope installed?

Thank you

mhadaniya's avatar

Apparently laravel/telescope have a deprecated dependency not support by heroku =/

Please or to participate in this conversation.