Closed domthomas-dev closed 2 years ago
Same issue here using:
Same issue here using:
I'm getting the same:
I'm having a hard time reproducing this. How can I trigger this error in a vanilla Laravel app?
I'm having a hard time reproducing this. How can I trigger this error in a vanilla Laravel app?
I haven't tried with a brand-new Laravel app, but I think I've experienced it on two different apps that I'm working on.
I'm pretty sure I've seen it off and on over the last several weeks and it seemed to have something to do with when I'd try to log something using the standard Laravel log facade. (Take that with a grain of salt because my memory's a little blurry...but I remember being frustrated that I couldn't use the log for troubleshooting.)
Anyway, I'll try to take some time next time it happens to see if I can let you know more.
In one case, it's a L8 project that is pushing two years old with all sorts of stuff going on. In the other, it's another L8 app that is only a month or two old which uses Jetstream...not much else. But, both use Filament Admin...which may or may not be related. I'd love to hear if any of the others are also using that package.
Back on the "new" project and I can replicate it very easy. There's a bit of code that I'm trying to troubleshoot. I was enabling and then dumping the query log around a search query and I get the error.
When I have this, I get the ApplicationLogPayload
class not found exception:
\Illuminate\Support\Facades\Log::debug('test');
(Of course, I was trying to dump the query log, but I dropped that to see if it made any difference.)
When I comment that line out, then it works fine:
// \Illuminate\Support\Facades\Log::debug('test');
The app, as mentioned earlier, is a Laravel 8 app with Jetstream (livewire, no teams), and Filament Admin. It's basically a Filament Admin app.
The other app that I work on where I've observed this also uses Filament Admin and it's only a recent addition. I don't think I noticed this error before Filament Admin was introduced...which leads me to believe that it's somehow related to that package.
I'm not sure if this helps or not. Please let me know what else I can help with. In the meantime, if I have time to dig a little and/or come across something, I'll come back here to post/share. 🤓
@telkins thanks for the research, I don't think it's really something with Filament alone as I don't use that in any of my projects, but do get the error. I had to remove ray from 4 projects already as developing became a bit of a pain. I'm searching for examples too. When I find something, I'll definitely post it here.
@telkins thanks for the research, I don't think it's really something with Filament alone as I don't use that in any of my projects, but do get the error. I had to remove ray from 4 projects already as developing became a bit of a pain. I'm searching for examples too. When I find something, I'll definitely post it here.
Thx. Nice to know it doesn't have anything to do with Filament Admin. 😅
How do you get rid of ray, though? I'm not requiring it explicitly.
I'll add that it seems to occur whenever there's an error/exception. This might help me going forward....at least until the issues are resolved or I figure out how to remove it. 🤓
@telkins run composer why spatie/laravel-ray
and remove all packages that use laravel-ray
. It was the fastest alternative I found until the issue is resolved.
One thing I noticed is that I was using a really old config file, as I was not really aware of its existence because of the unusual config file location. I don't know wether or not this was causing the issue, but I'm installing the package to my projects again to see if I run into some trouble the next couple of days.
@voicecode-bv Thanks, being able to reproduce this error would greatly help us to fix it.
Hi,
We've noticed the issue ourselves on a couple of production boxes over a couple of versions, in both cases the laravel-ray package was included in require-dev if it helps narrow anything done.
Versions were/are
In our case the only difference between our local config file and the current one in this package are we are missing the following three keys, send_duplicate_queries_to_ray, send_slow_queries_to_ray and send_http_client_requests_to_ray and our host default is falling back to the default homestead ip as that's how we published it.
Thanks,
@freekmurze Just got one in a form request. Stripped it down a bit to narrow things down.
Good to know:
<?php
namespace App\Http\Requests\Api\V1\OCPI;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
class UpdateLocationRequest extends FormRequest
{
// Authorize request.
public function authorize(): bool
{
return true;
}
// Validation rules.
public function rules() : array
{
return [
//
];
}
// Handle request.
public function handle()
{
Log::info('Location put: '.json_encode(request()->all()));
}
}
// Handle request. public function handle() { Log::info('Location put: '.json_encode(request()->all())); }
This seems to line up with some of the experiences I described earlier in this thread, which was that it would seem to happen when I was simply trying to log something...at least some of the time.
But, I don't think that it's always happening when I try to log something. 😕
Some findings:
ApplicationLogPayload2
in the vendor/
directory makes it work again.$payload = new ApplicationLogPayload($message->message);
with $payload = new BoolPayload(true);
works as well.Edit: Ok I got something else interesting: I am using Valet and it does not give this error when I run through php artisan serve
.
Edit: restarting Valet solves it.
Edit: It does not only occur on Valet, because I got this error on prod where I accidentally also included dev dependencies.
P.S. I am on:
"spatie/laravel-ray": "1.29.0" PHP 8.1.0 Laravel 8.79.0
Laravel Framework 8.80.0 PHP 8.1.1 Ray Version 1.19.0 (1.19.0) Composer version 2.2.2
same problem
[2022-01-19 11:37:58] local.ERROR: Class "Spatie\Ray\Payloads\ApplicationLogPayload" not found {"exception":"[object] (Error(code: 0): Class \"Spatie\\Ray\\Payloads\\ApplicationLogPayload\" not found at /Users/arturas/***/ure/vendor/spatie/laravel-ray/src/Watchers/ApplicationLogWatcher.php:24)
[stacktrace]
#0 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(404): Spatie\\LaravelRay\\Watchers\\ApplicationLogWatcher->Spatie\\LaravelRay\\Watchers\\{closure}(Object(Illuminate\\Log\\Events\\MessageLogged))
#1 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(249): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Log\\\\...', Array)
#2 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(245): Illuminate\\Events\\Dispatcher->dispatch('Illuminate\\\\Log\\\\...')
#3 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(186): Illuminate\\Log\\Logger->fireLogEvent('warning', 'Return type of ...', Array)
#4 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(106): Illuminate\\Log\\Logger->writeLog('warning', 'Return type of ...', Array)
#5 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(102): Illuminate\\Log\\Logger->warning('Return type of ...')
#6 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Support/helpers.php(377): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(Object(Illuminate\\Log\\Logger))
#7 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(105): with(Object(Illuminate\\Log\\Logger), Object(Closure))
#8 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(72): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleDeprecation('Return type of ...', '/Users/arturas/...', 146)
#9 /Users/arturas/***/ure/vendor/composer/ClassLoader.php(571): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8192, 'Return type of ...', '/Users/arturas/...', 146)
#10 /Users/arturas/***/ure/vendor/composer/ClassLoader.php(571): include('/Users/arturas/...')
#11 /Users/arturas/***/ure/vendor/composer/ClassLoader.php(428): Composer\\Autoload\\includeFile('/Users/arturas/...')
#12 /Users/arturas/***/ure/vendor/spatie/laravel-ray/src/Watchers/ApplicationLogWatcher.php(24): Composer\\Autoload\\ClassLoader->loadClass('Spatie\\\\Ray\\\\Payl...')
#13 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(404): Spatie\\LaravelRay\\Watchers\\ApplicationLogWatcher->Spatie\\LaravelRay\\Watchers\\{closure}(Object(Illuminate\\Log\\Events\\MessageLogged))
#14 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(249): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Log\\\\...', Array)
#15 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(245): Illuminate\\Events\\Dispatcher->dispatch('Illuminate\\\\Log\\\\...')
#16 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(186): Illuminate\\Log\\Logger->fireLogEvent('error', 'Unsupported ope...', Array)
#17 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/Logger.php(94): Illuminate\\Log\\Logger->writeLog('error', 'Unsupported ope...', Array)
#18 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(590): Illuminate\\Log\\Logger->error('Unsupported ope...', Array)
#19 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(252): Illuminate\\Log\\LogManager->error('Unsupported ope...', Array)
#20 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(49): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(TypeError))
#21 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\\Routing\\Pipeline->handleException(Object(Illuminate\\Http\\Request), Object(TypeError))
#22 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#23 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#26 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#27 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#29 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#30 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#35 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#36 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Router.php(723): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#37 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#38 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#39 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Routing/Router.php(651): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#40 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#41 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#42 /Users/arturas/***/ure/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /Users/arturas/***/ure/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /Users/arturas/***/ure/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /Users/arturas/***/ure/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /Users/arturas/***/ure/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /Users/arturas/.composer/vendor/laravel/valet/server.php(234): require('/Users/arturas/...')
#63 {main}
"}
I wonder if it has something to do with composer. If you report further errors, do mention the composer version number as well.
I wonder if it has something to do with composer. If you report further errors, do mention the composer version number as well.
Composer 2.0.13 on my side
2.1.3 here locally 2.2.4 on production
2.2.4 for me. The problem is when I use Log Facade.
Happening to me too... After some trials, I found out that it happens when I have any error, in my case in a controller if that helps (though I think it won't...). Any error triggering an exception will do (syntax error, missing translation, ...). The weird thing is that in the action code, I do not call ray at all.
Versions :
Hope it helps fixing it
We're running into the same issue when using the array_merge function within our Controller without providing array parameter.
Having the same issue. We don't use ray but it is used by one of the dependencies seems like.
The issue started after upgrading Composer to v2 & PHP to 8.1.
Update Looks like for our case the issue is related to the PHP upgrade from 8.0 to 8.1. At first, I thought it was composer but with PHP 8.0 & composer 2 the issue can't be reproduced. I'm going to do a further investigation but my guess is that there is some PHP 8.1 error being triggered before the ApplicationLogPayload is loaded. Thought this might help others having this issue to debug as well.
We are having the same issue after upgrading to PHP 8.1
I believe that it is a problem, but I still can't reproduce it. I'd be grateful if anyone here can make a small Laravel app that demonstrates the problem.
I believe that it is a problem, but I still can't reproduce it. I'd be grateful if anyone here can make a small Laravel app that demonstrates the problem.
@freekmurze I have been trying to recreate it locally without success. In my case, the error only occurs on our staging server. For local env, I use Laravel Sail but with the same PHP 8.1.1 version, composer 2.2 and so on. So I think it is not necessarily the PHP version that breaks it.
Laravel version 8.81.0
Laravel locale en
Laravel config cached false
PHP version 8.1.1
Composer version 2.2.5
Laravel Telescope: 4.7.0
Laravel Sentry: 2.11
cdn-loop: cloudflare
scheme: https
port: 8443
At the end of debug stack I have debug level log message:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
And a warning level message:
Return type of Opis\Closure\ReflectionClosure::isStatic() should either be compatible with ReflectionFunctionAbstract::isStatic(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/releases/.../vendor/opis/closure/src/ReflectionClosure.php on line 49
Not sure if any of this is helpful.
We had the same issue.
In our case the php8.1-redis
extension was missing.
We've upgraded to PHP8.1 and our Laravel Sail docker runtime was outdated.
I had same issue.
In my case I created PHP8.1 Enums in 'App/Enums' directory.
When I call
MyEnum::from(notContainingValueFromEnum)
the issue occurs
didn't test with fresh laravel installation
It throws that error in all exceptions
We had the same issue. In our case the
php8.1-redis
extension was missing.We've upgraded to PHP8.1 and our Laravel Sail docker runtime was outdated.
I can confirm that this (for some reason) works.
Hi this is happen to me when i have issue of missing property of DTO using https://github.com/spatie/data-transfer-object with Strict rule
this is our base DTO class
<?php
namespace App\Support\DTO;
use Spatie\DataTransferObject\Attributes\Strict;
use Spatie\DataTransferObject\DataTransferObject;
#[Strict] # https://github.com/spatie/data-transfer-object#strict-dtos
abstract class StrictDataTransferObject extends DataTransferObject
{
}
laravel: 8.82.0 ray: 1.33.2 laravel-ray: 1.29.0 PHP: 8.1.0
Getting the same issue on Laravel 9.
@heychazza did you perhaps get that in a vanilla Laravel 9 app? If so can you share it? Still having troubles replicating this.
@heychazza did you perhaps get that in a vanilla Laravel 9 app? If so can you share it? Still having troubles replicating this.
Hey, currently running this within a Jetstream app. For context, I'm trying to Ray debug the "PaymentSucceeded" event within Spark where I saw this.
Running PHP 8.1, Latest Composer, with Laravel 9.
@heychazza did you perhaps get that in a vanilla Laravel 9 app? If so can you share it? Still having troubles replicating this.
I don't think you will find it in any specific codebase. As mentioned earlier, I "fixed" it by restarting Valet, no code changes. I haven't ran into it ever since 🤔
Fixed mine, recloning the damn repo fixed it..
Do I know why? No, haha
https://twitter.com/heychazza/status/1491512024777564160?s=20&t=Ynk00DiNSQpBco8RXMmuqQ
Boa noite, também estou enfrentando este problema em minha aplicação PHP 8.1.
{ message: "Class "Spatie\Ray\Payloads\ApplicationLogPayload" not found", exception: "Error",…} exception: "Error" file: ".../vendor/spatie/laravel-ray/src/Watchers/ApplicationLogWatcher.php" line: 24 message: "Class \"Spatie\Ray\Payloads\ApplicationLogPayload\" not found" }
O interessante é que é em uma parte específica da aplicação, estou buscando investigar a fundo para mais informações.
I had this issue on a production system. Redeploying with Envoyer solved it. Sounds similar to @heychazza.
I had the same issue, but in my code, the issue was caused by a wrong event like the following example:
/* Example */
class User extends Model
{
protected static function boot()
{
static::saved(static function () => Cache::forget('user-'. $this->id));
}
}
$this
was the error. Check at your code removing the package laravel-ray for a test: then add it again when you find the issue.
I had the same issue, but in my code, the issue was caused by a wrong event like the following example:
/* Example */ class User extends Model { protected static function boot() { static::saved(static function () => Cache::forget('user-'. $this->id)); } }
$this
was the error. Check at your code removing the package laravel-ray for a test: then add it again when you find the issue.
For me the issue appeared when doing an info()
with a simple string.
hmm, it happen to me all the time when spatie/data-transfer-object
failed with strict rule
Same for me, only on PHP 8.1 (with Valet on an Intel Mac).
Changing file and class name to ApplicationLogPayload2
makes it work. Removing vendor/
and running composer install
and it's broken again 🙃
@freekmurze do you have any ideas for me to debug it? Any files/logs or smth I could check? 🤔
I checked vendor/composer/autoload_static.php
and vendor/composer/autoload_classmap.php
and I see no peculiarities. ApplicationLogPayload
is included in both files. I compared the occurrences to BoolPayload
occurrences in the Composer directory and there seems to be no difference.
As a workaround for those who don't really use it but it's still indirectly required, it can just be disabled by adding dont-discover
in root composer.json:
"extra": {
"laravel": {
"dont-discover": {
"spatie/laravel-ray"
}
}
}
As a workaround for those who don't really use it but it's still indirectly required, it can just be disabled by adding
dont-discover
in root composer.json:"extra": { "laravel": { "dont-discover": { "spatie/laravel-ray" } } }
hmm will try this later, thanks for sharing
As a workaround for those who don't really use it but it's still indirectly required, it can just be disabled by adding
dont-discover
in root composer.json:"extra": { "laravel": { "dont-discover": { "spatie/laravel-ray" } } }
But then you have to register the service provider manually in your code, right? Wouldn't that bring the error back?
But then you have to register the service provider manually in your code, right? Wouldn't that bring the error back?
Yeah, but I specifically meant a case when you don't really use it or rely on it and it's just some of your "ghost" indirect dependencies breaking your app. It may sound strange, but that was the case for me. It was a surprise for me actually, that we had this dependency (it is required by orchestra/testbench
in my case, but we don't really use it).
@Amegatron AH, yes. That is true. It's pretty weird for a library/helper package to include this as a dependency I have to say. It's not even a dev dependency.
Occured to me on having a ParseError
-Throwable within a livewire component.
namespace Spatie\LaravelRay\Watchers;
[...]
class ApplicationLogWatcher extends Watcher
{
public function register() : void
{
/** @var \Spatie\LaravelRay\Ray $ray */
$ray = app(Ray::class);
$this->enabled = $ray->settings->send_log_calls_to_ray;
Event::listen(MessageLogged::class, function (MessageLogged $message) {
if (! $this->shouldLogMessage($message)) {
return;
}
if (! class_exists('Spatie\Ray\Payloads\ApplicationLogPayload')) {
return;
}
$payload = new ApplicationLogPayload($message->message);
[...]
Adding a class_exists()
check fixed the issue for me, and Laravel Ignition showed up as expected.
Describe the bug The class "Spatie\Ray\Payloads\ApplicationLogPayload" not found
PHP version: 8.1.0 Laravel version: 8.78.1
NB : I see this site, but ..... https://php-download.com/package/spatie/laravel-ray/file/src/Watchers/ApplicationLogWatcher.php