Problem/Motivation
After updating my site from 8.6.x -> 8.7.x, all anonymous user traffic gets the following error:
The 'entity:user' context is required and not present.
All updates preformed as expected and I don't know why I am seeing these errors. I pulled down a version of 8.7.x and compared the two stack traces between the working 8.7.x and my updated site and found that ContentEntityStorageBase::getFromPersistentCache()
returns null on my site while in 8.7.x it returns an anonymous user object. Here is the stack trace:
* `EntityConverter::convert()`
* `LazyContextRepository::getAvailableContexts()`
* `CurrentUserContext::getRuntimeContexts()`
* `EntityStorageBase::load()`
* `SqlContentEntityStorage::doLoadMultiple()`
* `ContentEntityStorageBase::getFromPersistentCache()`
This is due to no record in the users table for the anonymous user.
Proposed resolution
Add a hook_requirements() to check that there's a record for user 0 and warn the site administrator if not. There's already a page on Drupal.org with instructions on how to update: Restore the anonymous (user ID 0) user record
Remaining tasks
Write a patch
Review
Commit
User interface changes
When anonymous exists
No status message