I'm deploying using envoyer as usual. The one caveat is that during my local host development (and while i was switching git branches).. I faced this error:
[ReflectionException] Class App\Http\Controllers\Admin\BatchUpdateStoresController does not exist
I solved it by clearing the routes cache (see details here).
The problem now is that when I deployed on envoyer.. I'm getting this error on the nginx logs:
PHP message: PHP Fatal error: Uncaught ReflectionException: Class hash does not exist in /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php:1479
Stack trace:
#0 /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php(1479): ReflectionClass->__construct('hash')
#1 /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php(1433): Illuminate\Container\Container->build('hash', Array)
#2 /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php(2011): Illuminate\Container\Container->make('hash', Array)
#3 /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php(1686): Illuminate\Foundation\Application->make('hash')
#4 /home/forge/default/envoyer/releases/20180306221058/bootstrap/cache/compiled.php(524): Illuminate\Container\Container->offsetGet('hash')
#5 /home/forge/default/envoyer/releases/20180306221058/bootstrap/
I tried deleting the /home/forge/default/envoyer/releases/20180306221058/bootstrap folder all together.. but that made it only worse (ie i wasn't even getting nginx error logs anymore).
what do I do?
it turns out that i add a library to composer and added its service provider and alias to config/app.php like so:
but then later on removed that library from composer (b/c i stopped using it) and forgot to update the service provider.
Updating the service provider solved the problem.
Bonus
I got the same problem again from one of my engineers working on a Pull Request that has like 100 commits in it (it's a topic branch.. please don't judge).
He affirmed that all the libraries are used.
So what I did is that I simply ran a git diff on two specific files only amongst that large range:
config/app.phpandcomposer.jsonlike so:Composer.json
config/app.php
so the problem was clear: basically we're including
"orangehill/iseed": "2.2",as arequire-devrequirement, but not checking if the env is dev when we register it as a service provider.. so it blew up.so this fixed it inside of
app/Providers/AppServiceProvider.php:bonus 2
sometimes you have to remove the entire bootstrap directory
then run
but laravel won't work after that, so you must git revert the change of deleting all of bootstrap (which should be in your git repo anyways).. and you're golden after that