statamic / seo-pro

An all-in-one site reporting, metadata wrangling, Open Graph managing, Twitter card making, sitemap generating, turn-key addon for Statamic.
https://statamic.com/addons/statamic/seo-pro
52 stars 34 forks source link

`Value` instance type error when merging non-existent `seo` data #245

Closed stuartcusackie closed 1 year ago

stuartcusackie commented 1 year ago

Just launch a new website. The reports used to run fine on my localhost but now they don't seem to go anywhere: image

I have tried this on a 'sync' queue and on a 'redis' queue. Yesterday it got to about 4 hours with 0% progress.

joshuablum commented 1 year ago

Hey @stuartcusackie,

What's the output of php please support:details?

fine on my localhost but now they don't seem to go anywhere

Like it still works locally but not in production? Or not working locally anymore?

Just launch[ed] a new website.

What did you do prior to when it stopped working? Could you track that in your Git history? Update dependencies? Something else?

Could you please run php artisan optimize:clear && php please stache:refresh

Anything in the logs, like storage/logs/laravel.log?

stuartcusackie commented 1 year ago

Hi, thanks for looking into this so quickly. I have just checked the logs and there seems to be a problem with the default queue jobs: Illuminate\Foundation\Console\QueuedCommand has been attempted too many times or run too long

It seems the job is timing out and 60 seconds is not long enough. I am going to extend the job to 5 mins: The process "'/usr/bin/php8.1' 'artisan' 'queue:work' 'redis' '--once' '--name=default' '--queue=default' '--backoff=0' '--memory=128' '--sleep=10' '--tries=1'" exceeded the timeout of 60 seconds.

I have deleted the queue and started it again but the same problem occurs. I'm pretty sure they only job running on this queue is for SEO Pro reports. I have another queue that works fine.

Environment Laravel Version: 9.43.0 PHP Version: 8.1.12 Composer Version: 2.2.3 Maintenance Mode: OFF

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

Statamic Addons: 7 Antlers: regex Version: 3.3.60 PRO

Statamic Addons jonassiewertsen/statamic-live-search: 1.5.1 jonassiewertsen/statamic-livewire: 2.9.0 justbetter/statamic-image-optimize: 1.1.4 rias/statamic-redirect: 2.5.0 spatie/statamic-responsive-images: 2.14.4 statamic/seo-pro: 3.1.2 stuartcusackie/statamic-cache-requester: 1.0.2

stuartcusackie commented 1 year ago

New errors appearing now:

{
    "class": "TypeError",
    "message": "ArrayIterator::__construct(): Argument #1 ($array) must be of type array, null given",
    "code": 0,
    "file": "/home/forge/mywebsite.ie/vendor/statamic/cms/src/Fields/Value.php:73",
    "trace": [
        "/home/forge/mywebsite.ie/vendor/statamic/cms/src/Fields/Value.php:73",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php:961",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:808",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Cascade.php:39",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Reporting/Report.php:125",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Collections/Arr.php:560",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:739",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Reporting/Report.php:133",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Reporting/Report.php:111",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Reporting/Report.php:106",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Reporting/Report.php:74",
        "/home/forge/mywebsite.ie/vendor/statamic/seo-pro/src/Commands/GenerateReportCommand.php:38",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Container/Util.php:41",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Container/Container.php:651",
        "/home/forge/mywebsite.ie/vendor/laravel/framework/src/Illuminate/Console/Command.php:182",
jesseleite commented 1 year ago

@stuartcusackie I'm going to say the queue stuff isn't a bug, since we recommend moving to proper queues for larger reports, and link to Laravel docs, etc. in SEO Pro's documentation.

That said, we fixed the error you mentioned in https://github.com/statamic/seo-pro/issues/245#issuecomment-1348367004 and tagged 3.1.3 👍

stuartcusackie commented 1 year ago

Thanks, no errors appearing now after upgrading to 3.1.3. Report generated successfully!

It seems a bit risky to be increasing the queue timeouts for the default queue. It would be fine if we could use a separate queue, but Statamic tends to throw everything onto the default. Perhaps these report jobs should be split into lots of smaller jobs, .e.g. a job per entry.

jesseleite commented 1 year ago

Maybe this is a good feature request, feel free to open an issue for this. Can't comment on splitting the report job into smaller jobs (that would likely require a bigger overhaul), but we could probably at least add config to allow for running on a non-default queue.