craft-seomatic icon indicating copy to clipboard operation
craft-seomatic copied to clipboard

Content SEO has deleted all existing data and does not recognise Entries

Open simon-mundy opened this issue 2 years ago • 8 comments

Describe the bug

On Monday 19 I updated my CraftCMS installation (Craft Pro 3.7.54 on PHP 7.4.30) and included the new version of SEOMatic (v. 3.4.38). Clicking on the control panel and navigating to SEOmatic -> Content SEO shows a completely empty table and does not allow me to manage the individual SEO for all my entries.

To reproduce

Hard to replicate, as the behaviour is entirely unexpected.

Screenshots

Additional Info

  • I can see a warning in my browser console: vuetable: pagination-path "links.pagination" not found. It looks like the data returned from the sever does not have pagination information or you may have set it incorrectly. You can explicitly suppress this warning by setting pagination-path="".
  • Checking the web log I can see an issue with an SVG image somewhere: #5 [...]/www.swaab.com.au/vendor/nystudio107/craft-seomatic/src/helpers/ImageTransform.php(145) however I couldn't see that killing all my content

Here's what I am seeing:-

Screen Shot 2022-09-20 at 11 30 21 am Screen Shot 2022-09-20 at 11 31 06 am

Happy to provide any sort of diagnostic info - looking for support ASAP as this obviously directly affects my clients' SEO and social sharing in a live environment.

simon-mundy avatar Sep 20 '22 01:09 simon-mundy

I'm not seeing anything in these updates that should cause anything like what you're seeing; if you look at the database, do you see anything in the seomatic_metabundles table?

Did anything change with your server environment in the interim at all?

khalwat avatar Sep 20 '22 03:09 khalwat

Also you mention that you just did these updates -- how were the updates done, exactly?

khalwat avatar Sep 20 '22 03:09 khalwat

If you open the Chrome Developer Console (or whatever browser you're using) when visiting the Content SEO page, are you seeing any errors in there?

khalwat avatar Sep 20 '22 03:09 khalwat

Hi @khalwat they were applied via updates in the control panel. There is an entry in the seomatic_metabundles table and I even restored that entry from older backups to see if that fixed anything.

No change to my server environment. And yes I see the vue warnings in console as per original post.

simon-mundy avatar Sep 20 '22 04:09 simon-mundy

Well, there shouldn't be just one entry in the seomatic_metabundles, there should be one for every Section that you have. How many rows are in that able?

Was anything else done with the database that could have somehow caused this? This is not something I've ever heard of just happening spontaneously, and there's no code in SEOmatic that would just drop that table.

FWIW, it is not recommended that you do updates live on a production server via the CP; here's an article on the subject:

https://nystudio107.com/blog/updating-craft-cms-without-headaches

Clearly something went amiss with the update process, or something else happened which affected the data in seomatic_metabundles. I'd suggest restoring those tables from a backup prior to the update.

khalwat avatar Sep 20 '22 15:09 khalwat

Viewing the code on https://www.swaab.com.au/ it appears to me that all of the meta information continues to be there?

khalwat avatar Sep 20 '22 15:09 khalwat

Thanks @khalwat I didn't know there should be extra tables. What has me puzzled, though, is that if there are no Entry records in that table, how do you regenerate them to allow re-associating and configuring them again?

I will take your advice re: using Composer to update. Usually there's been no problem that I haven't been able to solve even when things go wrong, but this is right out of the left-field.

I'll go right back through my backups to see if I have additional fields I can restore from.

If you have any advice re: regenerating entry configuration I'd really appreciate it - thank you for being so responsive.

simon-mundy avatar Sep 20 '22 23:09 simon-mundy

OK - I just re-added those records via a database backup. Confirmed they were all present, navigated to the Entries page in the SEOmatic Control Panel. Somewhere during this process SEOmatic seems to have deleted all the records that I had re-added.

simon-mundy avatar Sep 20 '22 23:09 simon-mundy

Something does not sound right... SEOmatic should not be deleting any records.

Do all of your sections have public URLs? Are all of your sections public?

khalwat avatar Sep 21 '22 16:09 khalwat

Hi @khalwat I've found and fixed the issue, not sure how best to prevent this in the future. The original site was published in 2017 and CraftCMS has obviously progressed since then.

Essentially the field in sites called hasUrls was somehow set to 0 for my main site. I haven't touched this since it went live so somewhere along the way this may have been added or used differently?

So when I came to the Admin route /admin/seomatic/content it then fires off Seomatic::$plugin->metaBundles->deleteVestigialMetaBundles($metaBundles);. For every entry meta bundle (except GLOBAL) it performs a test to see if it has public URLs. That test involves checking the SiteHelper::siteEnabledWithUrls($siteSetting->siteId) and if it doesn't it called deleteVestigialMetaBundles which was what was deleting my entries.

I understand that it makes sense to drop any unnecessary data in your seomatic_metabundles table however maybe it would be less catastrophic to make this function a maintenance task from within the 'Plugin Settings' or even a separate 'Maintenance' tab? Lucky I made backups of the database daily/weekly/monthly or I would have lost this forever and the client would have rightly been cranky.

Appreciate you following this up for me, and apart from this issue SEOmatic has been rock-solid for me.

simon-mundy avatar Sep 22 '22 00:09 simon-mundy

Glad you have it resolved. I'm a little conflicted about what to do regarding the situation you ran into, however.

In theory, there are a lot of things that shouldn't actually be working if your primary site has no URLs. I wonder if a Craft migration somewhere went astray, because that should not be set that way.

khalwat avatar Sep 22 '22 06:09 khalwat