An anonymous user must be identified by session ID (line 176 -> line 223)

Created on 20 June 2021, over 3 years ago
Updated 13 December 2023, 12 months ago

Problem/Motivation

Error with the anonymous user on any entity with a flag enabled.

The error is: Uncaught PHP Exception LogicException: "An anonymous user must be identified by session ID." at ...\web\modules\contrib\flag\src\FlagService.php line 176

This means that the site is completely unusable for anonymous users, as any entity of type "content" produces a WSOD.
Disabling the flags for the entity removes the error.

My current setup is:
Drupal 9.2
Flag 8.x-4.0-beta2

At the moment, the message stack is unusable with this issue.
Is this something to do with this?: https://www.drupal.org/node/3006306

Will updating to dev fix this?

Thanks

Steps to reproduce

Browse to any entity page with a flag enabled as anonymous user.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Postponed: needs info

Component

Flag core

Created by

🇦🇺Australia CBEEM

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • @jcmartinez I also work on an Open Social project and I have found one place, where the aforementioned patch could be applied, it's in social_group module in GroupMuteNotify.php file at line 54, so the fix there should theoretically look the same like in message_subscribe module:

    $flaggings = $this->flagService->getAllEntityFlaggings($group, $account, \Drupal::request()->getSession()->getId());

    I will try to reproduce the error and then test this fix, but if you get to it sooner then let us know please how it went. :)

  • 🇨🇦Canada paintingguy

    Pretty sure the message subscribe module causes a lot of related issues in other modules.

  • 🇳🇱Netherlands robertragas

    For Open Social it was indeed related to group mute function, so custom code and not the Flag module itself.
    https://www.drupal.org/project/social/issues/3355315

Production build 0.71.5 2024