laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.87k stars 658 forks source link

Attempt to read property "failedJobIds" on null - when you navigate to a completed batch #1381

Closed irakliShengelia closed 7 months ago

irakliShengelia commented 10 months ago

Horizon Version

5.16

Laravel Version

10.42

PHP Version

8.2

Redis Driver

PhpRedis

Redis Version

^2.0.2

Database Driver & Version

No response

Description

When navigating to a completed or a non-existent batch id - horizon throws internal errors in the background.

Steps To Reproduce

Reproduction 1

  1. Navigate to https://myapp.test/horizon/batches/9b374ff9-eadd-4f0d-913c-bd3e16d034dc (or any non-existent/completed batch id)
  2. See an infinite loader. Check The logs. Stack Trace Below.

Reproduction 2

  1. Create a batch
  2. Click on it on the batches page so you see navigate to the single batch page (with automatic updates)
  3. As soon as the batch is completed (reaches 100%) - horizon starts throwing errors in the background
  4. Refresh - infinite loader - errors in the background continue

{ "class": "ErrorException", "message": "Attempt to read property \"failedJobIds\" on null", "code": 0, "file": "/opt/app/vendor/laravel/horizon/src/Http/Controllers/BatchesController.php:63", "trace": [ "/opt/app/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:254", "/opt/app/vendor/laravel/horizon/src/Http/Controllers/BatchesController.php:63", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:43", "/opt/app/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php:21", "/opt/app/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingRoutingDispatcher.php:19", "/opt/app/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Routing/TracingControllerDispatcherTracing.php:20", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:259", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:205", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:799", "/opt/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:141", "/opt/app/vendor/laravel/horizon/src/Http/Middleware/Authenticate.php:23", "/opt/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180", "/opt/app/app/Http/Middleware/HorizonAuth.php:26", "/opt/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:180", "/opt/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:116", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:798", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:777", "/opt/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:741", "/opt/app/vendor/laravel/framew... }

driesvints commented 9 months ago

Thanks, would love to see a PR for this one.

github-actions[bot] commented 9 months ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

irakliShengelia commented 9 months ago

@driesvints I can contribute the PR, though let's agree on the required/expected behavior:

Let's agree on the above and I'll spin up a PR

irakliShengelia commented 9 months ago

@driesvints Here's a draft PR #1383

driesvints commented 7 months ago

We'd still appreciate the same PR being sent to v5, thanks.