Problem/Motivation

When attempting to upgrade to version 2, I'm getting this warning message after running drush updb:

[warning] Undefined property: stdClass::$field_yoast_seo_title SqlContentEntityStorage.php:1269

Also, I noticed that the Snippet preview is returning "Unknow" value

Steps to reproduce

  1. Upgrade to the latest version composer require 'drupal/yoast_seo:^2.1'
  2. Update the database drush updb -y
  3. Try to edit any existing Reat-time SEO filed in your content type, you'll get the white screen of death
CommentFileSizeAuthor
#13 2025-04-22_09-10-12.png14.73 KBalfattal

Issue fork yoast_seo-3504939

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alfattal created an issue. See original summary.

dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal
dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned

I have tried to reproduce this issue using the steps that you have provided but not able to reproduce it.
Can you tell me what am i missing or you can share more info about it.?

michal_liszka’s picture

I had the same issue, but I figure out an error: `Undefined property: stdClass::$field_real_time_seo_description in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables() ` is caused by

Column not found: 1054 Unknown col  
  umn 'field_real_time_seo_title' in 'where clause': SELECT 1 AS "expression"                             
  FROM                                                                                                    
  "node_revision__field_real_time_seo" "t"                                                                
  WHERE ("field_real_time_seo_status" IS NOT NULL) OR ("field_real_time_seo_focus_keyword" IS NOT NULL)   
  OR ("field_real_time_seo_title" IS NOT NULL) OR ("field_real_time_seo_description" IS NOT NULL)         
  LIMIT 1 OFFSET 0; Array                                                                                 
  (                                                                                                       
  ) 

So I just found where exactly these fields were added: `yoast_seo_update_8202` and just re-run this single hook_update.

That's work for me and everythink works fine.

alfattal’s picture

@michal_liszka Could you please elaborate on how did you fix this issue and how did you found the fields that were added?

michal_liszka’s picture

@alfattal

After updating Drupal from version 10.1 to 10.4.4 and running drush deploy, the hook_update_N for yoast_seo did not execute properly, even though there was no custom code on the site that could interfere with this process.

While navigating through the admin panel, an error occurred: Undefined property: stdClass::$field_real_time_seo_description in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables(), and the Status Report displayed an error message stating that the field must be updated for the yoast_seo field. In some cases, simply opening the field’s edit page and saving it is enough to trigger the update. However, in this case, when trying to edit the field, I encountered an SQL error, which I described in my previous comment.

Since the field_real_time_seo_title and field_real_time_seo_description fields were not manually added, I searched the yoast_seo folder for references to “title” and “description” and found yoast_seo_update_8202. Within this hook_update, these fields are added to the database schema.

One possible solution, which I could apply in this case, is to either temporarily modify the update number in the code (e.g., changing 8202 to 8205 and then reverting it) or reset the module’s update number entirely and rerun the yoast_seo_N sequence.

Here is the sequence of steps to resolve this issue:
1. Edit the file directly:
vi modules/contrib/yoast_seo/yoast_seo.install
Change the update number, for example, from 8202 to 8205.
2. Run deploy or update database:
drush deploy
or
drush updb -y (agreement optional)
3. Update the hook registry:
drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('yoast_seo', 8204);"
where 8204 is the actual last executed hook update.

This approach ensures that the update runs correctly and resolves the issue with the missing fields.

alfattal’s picture

@michal_liszka Thank you for providing this detailed information. However, this approach cannot be applied on a production site without a patch.

ruslan piskarov made their first commit to this issue’s fork.

ruslan piskarov’s picture

Status: Active » Needs review
alfattal’s picture

Status: Needs review » Needs work
StatusFileSize
new14.73 KB

The patch in MR !39 applied successfully and it resolved the first part of the issue which is the error message. The second part (Snippet preview is returning "Unknow" value) remained unresolved.

Snippet preview is returning "Unknow" value

alfattal’s picture

@bramtenhove Any chance to take a look at this issue?

kingdutch’s picture

Priority: Major » Normal
Status: Needs work » Postponed (maintainer needs more info)

I'm not entirely comfortable with simply rerunning an update hook. I think one of the important clues that's missing in this issue is: What version did you upgrade from when this happened?

The issue seems to be quite specific and before simply running an update hook twice, I'd like to figure out why it didn't run in the first place.

alfattal’s picture

@kingdutch The version that I upgraded from when this happened was the latest on the (1.x) branch which is (1.9). No further updated to this branch since the 26 Aug 2024.

davidiio’s picture

We have a similar issue here. Upgrading from 1.9 to 2.2

It seems that yoast_seo.install file changed a lot between these two versions. A few update hooks were added but when I ran
drush updb command only update hook 8204 was listed and ran.

After that, every drush command display these warnings:

 [warning] Undefined property: stdClass::$field_yoast_seo_title SqlContentEntityStorage.php:1269
 [warning] Undefined property: stdClass::$field_yoast_seo_description SqlContentEntityStorage.php:1269

I then used this command to reset update hooks to 8200 and re-ran drush updb so update hooks 8201 8202 8203 and 8204 ran

drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('yoast_seo', 8200);"
drush updb
alfattal’s picture

Status: Postponed (maintainer needs more info) » Active

@kingdutch I've responded to your question three months ago. Any chance to progress with this issue?

alfattal’s picture

This doesn't look like an actively maintained module. I will remove it permanently and call it a day!