laravel / telescope

An elegant debug assistant for the Laravel framework.
https://laravel.com/docs/telescope
MIT License
4.89k stars 586 forks source link

Dispatching Job in Nova Event Hook Doesn't Create Entry #1498

Closed squareone-jarrod closed 3 months ago

squareone-jarrod commented 3 months ago

Telescope Version

5.1.0

Laravel Version

11.12.0

PHP Version

8.3.9

Database Driver & Version

MySQL 8.0.33 for MacOS on arm64 (DBngin)

Description

I have Nova installed (version 4.34.3) and I'm using the afterCreate observer to dispatch a job after a new resource has been created.

The job runs and is processed by the queue, but Telescope doesn't create an entry.

I'm running this on a local environment, but the same happens in a production environment. I created a new job to test this, with a simple Log::info() in the handle and the same happened.

I first noticed this happening whilst chaining jobs, but I've tested it by dispatching single jobs and this still occurs, even with dispatch_sync()

Here's an example:

public static function afterCreate( NovaRequest $request, Model $model ) {
    TestJob::dispatch( $model );
}

Steps To Reproduce

  1. Create a new Laravel application with Nova and Telescope installed
  2. Create a resource event hook
  3. Dispatch a job inside of the resource
  4. Check Telescope to see whether the entry has been created
driesvints commented 3 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

squareone-jarrod commented 3 months ago

Hi @driesvints

Thanks for the reply! Apologies if I've miscategorised this, but I figured it was a bug as Telescope should be creating the job entry in the Telescope panel?

Dispatching in other places works just fine, but the event hook in Nova seems to cause the entry to not be created.

driesvints commented 3 months ago

Most likely it's the fact that Telescope ignores Nova related actions: https://github.com/laravel/telescope/blob/5.x/config/telescope.php#L116

squareone-jarrod commented 3 months ago

Thank you @driesvints - that was indeed the issue.