mitydigital / statamic-logger

Detailed, customisable and human-friendly audit logging for Statamic
MIT License
2 stars 1 forks source link

Error loading statamic logger log #1

Closed mikemartin closed 8 months ago

mikemartin commented 8 months ago

Great job on the addon! I just installed it and received this error on the CP logger utility page. Screenshot and logger log file attached below.

[2023-10-29 15:57:18] staging.ERROR: Declaration of MityDigital\StatamicLogger\Http\Resources\LogResource::toArray(Illuminate\Http\Request $request): array must be compatible with Illuminate\Http\Resources\Json\JsonResource::toArray($request) {"userId":"96156a47-d799-4248-8a51-0ed6c2cfe99c","exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Declaration of MityDigital\\StatamicLogger\\Http\\Resources\\LogResource::toArray(Illuminate\\Http\\Request $request): array must be compatible with Illuminate\\Http\\Resources\\Json\\JsonResource::toArray($request) at /home/ploi/staging.burlingameproperties.com/vendor/mitydigital/statamic-logger/src/Http/Resources/LogResource.php:34)
[stacktrace]
#0 {main}
"}

Attached Statamic Logger log file: statamic-logger-2023-10-29.log

Screenshot 2023-10-30 at 10 03 29 am
martyf commented 8 months ago

Interesting as I can't replicate that here.

Can you please run php please support:details?

I've just made a change to the LogResource - can I get you to try:

composer require mitydigital/statamic-logger:dev-main

If this resolves your issue, then I'll tag a new release with it - but if not, will need the support details from above to try to be able to replicate it locally.

mikemartin commented 8 months ago

Hey @martyf The fix didn't help this error, I suspect that it might be because of Laravel 9.

Here's my support details:

Environment
Application Name: Burlingame
Laravel Version: 9.52.16
PHP Version: 8.2.11
Composer Version: 2.5.5
Environment: local
Debug Mode: ENABLED
URL: burlingame.test
Maintenance Mode: OFF

Cache
Config: CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Statamic
Addons: 17
Antlers: runtime
Stache Watcher: Disabled
Static Caching: full
Version: 4.30.0 PRO

Statamic Addons
aerni/advanced-seo: 2.3.0
aerni/livewire-forms: 8.1.0
aerni/social-links: 3.1.0
aerni/zipper: 2.3.0
edalzell/forma: 2.1
jacksleight/statamic-bard-texstyle: 3.1.3
jacksleight/statamic-miniset: 1.0.0
jonassiewertsen/statamic-livewire: 2.12.0
justbetter/statamic-image-optimize: 2.1.1
mikemartin/helpscout-beacon: 1.0.3
mitydigital/statamic-logger: dev-main
rias/statamic-color-swatches: 2.2.0
rias/statamic-redirect: 3.2.0
siterig/mailerlite: dev-main
swiftmade/statamic-clear-assets: 2.0.0
webographen/statamic-widget-cache-controller: 1.0.2
webographen/statamic-widget-continue-editing: 1.1.0
martyf commented 8 months ago

Can I get you to composer update mitydigital/statamic-logger please. I've removed the explicit return type for the response's toArray method.

mikemartin commented 8 months ago

Still same error. But I am seeing this intelephase error when i view LogResource.php Line 27.

Screenshot 2023-10-30 at 2 24 21 pm
martyf commented 8 months ago

Thanks for jumping on a call Mike and working through it all - this has been resolved and tagged with release 1.0.1