After updating to Drupal 8.7.0 and updating the database using drush updb system update 8702 fails. I'm not sure how to debug this, or where that error message is coming from exactly

> [notice] Update started: system_update_8702
> [error] Call to a member function getKey() on null

Any one experienced the same problem and have any idea how to fix this?
Thanks.

Stack trace from a duplicate issue:

php error report
[03-May-2019 11:34:15 America/Halifax] Error: Call to a member function getKey() on null in H:\new-drupal-project\web\core\modules\system\system.install on line 2278 #0 H:\new-drupal-project\web\core\includes\update.inc(184): system_update_8702(Array)
#1 H:\new-drupal-project\web\core\includes\batch.inc(295): update_do_one('system', 8702, Array, Array)
#2 H:\new-drupal-project\web\core\includes\batch.inc(137): _batch_process()
#3 H:\new-drupal-project\web\core\includes\batch.inc(93): _batch_do()
#4 H:\new-drupal-project\web\core\modules\system\src\Controller\DbUpdateController.php(186): _batch_page(Object(Symfony\Component\HttpFoundation\Request))
#5 [internal function]: Drupal\system\Controller\DbUpdateController->handle('start', Object(Symfony\Component\HttpFoundation\Request))
#6 H:\new-drupal-project\web\core\lib\Drupal\Core\Update\UpdateKernel.php(115): call_user_func_array(Array, Array)
#7 H:\new-drupal-project\web\core\lib\Drupal\Core\Update\UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request))
#8 H:\new-drupal-project\web\update.php(28): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#9 {main}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rick Bergmann created an issue. See original summary.

Rick Bergmann’s picture

Issue summary: View changes
cilefen’s picture

Title: System update 8702 fails for me » System update 8702 fails with " Error: Call to a member function getKey() on null in core\modules\system\system.install"
Category: Support request » Bug report
Issue summary: View changes
Priority: Normal » Major
xjm’s picture

Version: 8.7.0 » 8.7.x-dev
Priority: Major » Critical
Issue tags: +8.7.0 update
Rick Bergmann’s picture

Issue summary: View changes
amateescu’s picture

Status: Active » Needs review
FileSize
1.14 KB

@Rick Bergmann, can you try this patch?

Rick Bergmann’s picture

Yes, the patch works for me. Thank You @amateescu!

amateescu’s picture

No problem, it's nice to see that's the only problem you had with the 8.7.0 update :)

Ulminia’s picture

patch applied and working now i have another issue

taxonomy module
Update make_taxonomy_term_revisionable
Failed: Drupal\Core\Entity\EntityStorageException: The entity update process failed while processing the entity type taxonomy_term, ID: 1. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->copyData() (line 216 of H:\\web\core\lib\Drupal\Core\Entity\Sql\SqlFieldableEntityTypeListenerTrait.php).
menu_link_content module
Update make_menu_link_content_revisionable
Custom menu links have been converted to be revisionable

ideas?

amateescu’s picture

@Ulminia, can you check the recent log messages and see if there's any error recorded there?

plach’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

#9 seems a separate problem, the patch looks good to me and fixes the issue reported in the OP. Setting to NW for the missing test coverage.

amateescu’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
3.36 KB
4.51 KB

Here's the test coverage. The test-only file is also the interdiff.

The last submitted patch, 12: 3052467-12-test-only.patch, failed testing. View results

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Tests were added, I think this is ready for a committer review.

plach’s picture

RTBC +1

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed e14126d6a8 to 8.8.x and 2962eb2495 to 8.7.x. Thanks!

Nice find @Rick Bergmann and nice fix @amateescu. Thanks!

  • alexpott committed e14126d on 8.8.x
    Issue #3052467 by amateescu, Rick Bergmann: System update 8702 fails...

  • alexpott committed 2962eb2 on 8.7.x
    Issue #3052467 by amateescu, Rick Bergmann: System update 8702 fails...
gregrusson’s picture

I am having this same issue. Can someone guide me as to how I apply this patch to Druap 8.7.x?

cilefen’s picture

https://www.drupal.org/patch/apply is the basic. If you manage the site with Composer, use https://github.com/cweagans/composer-patches.

gregrusson’s picture

Thanks, @cilefen, I was able to get it to work through composer.

MagdalenaA67’s picture

Same error solved without patch.

I ran the update from 8.6.15 to 8.7.1 and first had the same errors:
[error] Call to a member function getKey() on null
[error] Update failed: system_update_8702

I then started over because the patch didn't work for me. I checked out live and dropped current db and added backup of live database to get me back to before I ran the update. I then ran these commands and it worked.

With new branch created from live and live update now local...

composer update drupal/core webflo/drupal-core-require-dev --with-dependencies
drush cr
drush updb
drush cr
check UI /admin/config/development/configuration if config isn't clean, which it should not be run drush cex

pameeela’s picture

Thanks everyone for taking part in this issue. If you'd like to help us make sure the 8.8.0 update is as smooth as possible, please consider signing up for the beta testing program at https://goo.gl/forms/bMBTMRSY3sKEscUJ3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

gease’s picture

The testDeletedEntityType test, introduced with this patch, breaks other post-update hook tests, #2960643-23: Cannot load entity by uuid after rename for example. What we do there is iterating through all config entities and loading them by UUID. $loadable = (bool) $entity_repository->loadEntityByUuid($entity_type_id, $entity->uuid()); This should be perfectly valid operation in post-update hook, but field configuration loading throws PluginNotFoundException 'The entity_test_update entity type does not exist.'
Created a separate issue #3092497: Deleted entity types now break update tests about that.

gease’s picture

FileSize
1.01 KB

Just a small patch illustrating the above problem.