When an action runs as a dispatched job and the job fails, the storage/logs/laravel.log shows a lot of details about job decorators and framework classes, however no mention of the App\Action\* that actually failed is shown. This leads to difficult triage since we can only go off of the message that can be benign.
When using Laravel Telescope, I'm able to see that the error message isn't related, and is more than likely a case of the class has a syntax problem and can't load so named arguments aren't accepted since that's further down the processing stack than where we failed at.
My example of the error inside the action class that is easily fixable if I can get more details in the log at runtime when it occurs.
Typed property App\Actions\MyAction::$api_records must not be accessed before initialization
In this case, I can see that I'm trying to access $this->api_records->count() before I set $this->api_records = collect(ApiClient::get('users')->data) above it.
Reproduction Steps
Create a action class and make an obvious typo that PHP will crash on.
Use Tinker(well) to run the action (ex. MyAction::make()->handle(key: $value)).
No logs appear in laravel.log, however Tinkerwell shows the PHP crash error. I'm not sure how to work around this. Maybe they appear in PHP error logs?
Use Tinker(well) to dispatch the action (ex. MyAction::dispatch(key: $value)).
Solution
Is there a better way to see PHP crash/error logs that I'm not aware of? Since I can get it in Telescope, I'm working around it but the logs are sending me on wild goose chases sometimes.
Version
Problem Statement
When an action runs as a dispatched job and the job fails, the
storage/logs/laravel.log
shows a lot of details about job decorators and framework classes, however no mention of theApp\Action\*
that actually failed is shown. This leads to difficult triage since we can only go off of the message that can be benign.When running the action as a dispatched job...
Root Cause
When using Laravel Telescope, I'm able to see that the error message isn't related, and is more than likely a case of the class has a syntax problem and can't load so named arguments aren't accepted since that's further down the processing stack than where we failed at.
My example of the error inside the action class that is easily fixable if I can get more details in the log at runtime when it occurs.
In this case, I can see that I'm trying to access
$this->api_records->count()
before I set$this->api_records = collect(ApiClient::get('users')->data)
above it.Reproduction Steps
MyAction::make()->handle(key: $value)
).laravel.log
, however Tinkerwell shows the PHP crash error. I'm not sure how to work around this. Maybe they appear in PHP error logs?MyAction::dispatch(key: $value)
).Solution
Is there a better way to see PHP crash/error logs that I'm not aware of? Since I can get it in Telescope, I'm working around it but the logs are sending me on wild goose chases sometimes.
Thanks again for an amazing tool!