Closed carterfort closed 6 years ago
Any chance the routes are cached?
I thought about that and ran ‘route:clear` just in case. No bones.
On Nov 14, 2017, 5:57 PM -0500, Marcus Moore notifications@github.com, wrote:
Any chance the routes are cached? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Is it a generic 404 or a model not found exception?
Move Horizon::auth() from routes to AppServiceProvider.php (register method).
For example
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
Horizon::auth(function ($request) {
if (! auth()->user()) {
return false;
}
return auth()->user()->hasRole('admin');
});
}
}
Horizon::auth in routes will not trigger. And without it, it will not work on other enviroment as local.
@dyzajash Thanks for that. Now I'm getting a Permission Denied error for writing the error log, which is weird because the system has no problem writing to the error log from anywhere else. I've checked the permissions and forge
is allowed to write to storage/logs
, so I'm not sure why it thinks it can't. But, progress!
Just change ACL to this directory. (If forge host is CentOS you should have acl installed by default. If you're using Ubuntu, try this: https://help.ubuntu.com/community/FilePermissionsACLs)
setfacl -R -m u:forge:rwx /directory/with/logs
setfacl -Rd -m u:forge:rwx /directory/with/logs # flag -d makes ACL default for this user
& check if error.log is not trying to save in /var/log/forge dir.
It was the Laravel logs that couldn't write, nothing to do with anything outside of the app.
The box is Ubuntu, I forget which version.
Oddly, the session and view files seem to be created and owned by www-data
instead of forge
. This is different than any other laravel install I have. I wonder if that has something to do with the problems I'm seeing.
You can always ACL for forge + www-data and see what group is writing files inside this directory. After debug you can fix the problem & remove ACL from that directory.
Move Horizon::auth() from routes to AppServiceProvider.php (register method).
Horizon::auth in routes will not trigger. And without it, it will not work on other enviroment as local.
That's interesting because I just added it in routes.php
and it works ?! However mine is very simplistic because the endpoint is protected by the webserver so I only return true;
from it. Nevertheless I had to add it for production.
I deployed the exact same code to a different server, and it worked just fine.
I think I must have screwed something up when upgrading to PHP 7.1, although I used the Forge upgrade button to do it so I'm not sure where I went wrong.
I'm closing this because it's not specific to Horizon. Thanks everyone for all your help!
I'm also getting 404 on /horizon (nginx 404). Tried clearing cache, route, config etc. Horizon:auth
is in a service provider's register()
. I already had issues with keeping Horizon working – it would work normally for a few weeks, then suddenly it stops. Frustrating.
Before this happened I made several deployments, but none of them touched Horizon-related code or settings. Deploy script includes horizon:terminate
. Forge says php artisan horizon
is running, and when I do php artisan horizon:supervisors
I can see that supervisors are running for my channels.
Any ideas? Thanks.
I'm also getting 404 on /horizon after installing. Tried clearing cache, route, config etc. I have no Horizon:auth in routes nor in service provider's register. I tried to add it but doesn't change. Don't really know what to do. I use Laravel 7 / PHP 7.4
I also had this error, tried everything and didn't work. I found out it was a config/horizon.php
error. I fixed it using the default one from Laravel 8.
Double check your HORIZON_DOMAIN
and HORIZON_PATH
settings, both in the config/horizon.php
and in your .env
. Of course followup with php artisan config:cache
- in my case I had a subdomain declared that needed to be removed and then the 404 was rectified.
In my local dev environment, I can visit
site.dev/horizon
and see the dashboard just fine.I pushed this up to my test server, which is php7.1 Forge-managed, and I'm getting the "Sorry, the page you are looking for could not be found." NotFoundHttpException.
I've added the
Horizon::auth()
rule in my routes. I've added an entry inconfig/horizon.php
for mydevelopment
environment. I added thehorizon:terminate
rule to the post-install process in Envoyer, and I've added the Daemon to runhorizon
in Forge.On the test server, I've published the Horizon assets, and I've checked
route:list
for thehorizon/{?view}
route (it's there). But I'm still getting the 404 not found exception.I've checked my Exception handler. It's stock. I can't for the life of me figure out what's happening.