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

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

Closed
irakliShengelia opened this issue Jan 30, 2024 · 5 comments

Comments

@irakliShengelia
Copy link

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
Copy link
Member

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

Copy link

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
Copy link
Author

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

  • When a batch is not found with the ID - Let's return a 404 response with a message "batch not found"
  • Handle the 404 response on the frontend side by
    a. Redirecting to the batches route
    b. Showing Batch Not found?

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

@irakliShengelia
Copy link
Author

@driesvints
Here's a draft PR #1383

@driesvints
Copy link
Member

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

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

No branches or pull requests

2 participants