For not logged in users, site throw this error:

The website encountered an unexpected error. Please try again later.
LogicException: An anonymous user must be identifed by session ID. in Drupal\flag\FlagService->getAllEntityFlaggings() (line 194 of modules/flag/src/FlagService.php).

Drupal\flag\FlagService->getAllEntityFlaggings(Object, Object) (Line: 24)
message_subscribe_email_flag_action_access('flag', Object, Object, Object)
call_user_func_array('message_subscribe_email_flag_action_access', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('flag_action_access', Array) (Line: 175)
Drupal\flag\FlagType\FlagTypeBase->actionAccess('flag', Object, Object, Object) (Line: 314)
Drupal\flag\Plugin\Flag\EntityFlagType->actionAccess('flag', Object, Object, Object) (Line: 145)
Drupal\flag\Plugin\Flag\UserFlagType->actionAccess('flag', Object, Object, Object) (Line: 355)
Drupal\flag\Entity\Flag->actionAccess('flag', Object, Object) (Line: 98)
Drupal\flag\ActionLink\ActionLinkTypeBase->getAsFlagLink(Object, Object) (Line: 23)
Drupal\flag\Plugin\ActionLink\AJAXactionLink->getAsFlagLink(Object, Object) (Line: 48)
Drupal\flag\FlagLinkBuilder->build('user', '1', 'email_user')
call_user_func_array(Array, Array) (Line: 356)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 151)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 166)
Drupal\Core\Render\Renderer->renderPlaceholder('callback=flag.link_builder%3Abuild&args[0]=user&args[1]=1&args[2]=email_user&token=GCdGR5FCVqLIzAYH2-ME7D7hVeeb5zSHsC4ULIdn5iY', Array) (Line: 698)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=flag.link_builder%3Abuild&args[0]=user&args[1]=1&args[2]=email_user&token=GCdGR5FCVqLIzAYH2-ME7D7hVeeb5zSHsC4ULIdn5iY', Array) (Line: 552)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 374)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)

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

admirernepali created an issue. See original summary.

joachim’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Needs work » Active
Issue tags: -bug

The signature of getAllEntityFlaggings() has changed in the latest alpha.

(BTW there is no point in tagging an issue with 'bug', since the category field already tells you that!)

admirernepali’s picture

It still seems not fixed. I still get the same error. Error happens for anonymous users only.

LogicException: An anonymous user must be identifed by session ID. in Drupal\flag\FlagService->getAllEntityFlaggings() (line 194 of /modules/flag/src/FlagService.php).

joachim’s picture

You are calling that method incorrectly.

admirernepali’s picture

I haven't changed or called any function. I just installed fresh module and while not logged it, getting that exception.

How do I suppose to call that method?

joachim’s picture

Status: Active » Fixed

You installed the new version of the module, but because the module is still in alpha, the API has changed.

message_subscribe_email_flag_action_access() is calling it wrong. It's not part of Flag. You need to change that code, or if it's another contrib module, get that module's maintainer to change it.

Status: Fixed » Closed (fixed)

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

admirernepali’s picture

Thanks for update.

When I disable that module, on cron run I get this error:

Type cron
Date Sunday, June 18, 2017 - 08:04
User Anonymous (not verified)
Location http://domain.com/admin/config/system/cron
Referrer http://domain.com/admin/config/system/cron
Message LogicException: An anonymous user must be identifed by session ID. in Drupal\flag\FlagService->getAllEntityFlaggings() (line 194 of /Applications/XAMPP/xamppfiles/htdocs/domain.ct/modules/flag/src/FlagService.php).
Severity Error
Hostname 127.0.0.1

Any idea about this?

This error is now not showing. Not sure what change I made.

dpi’s picture

A related issue has been created for message_subscribe: https://github.com/Gizra/message_subscribe/issues/102

drupaleze’s picture

This solved mine (at least the error is gone).

I simply located the Flag module and edited the file modules/flag/src/FlagService.php

On line 193 up to line 195, I commented those out

i.e.

/** DISABLED {
*throw new \LogicException('An anonymous user must be identifed by session ID.');
} */

For now, I don't have any issues, although I'm not really sure of the implications of this action.

oriol_e9g’s picture

eahonet’s picture

For me it was message_subscribe_email module and the patch from here fixed:
https://www.drupal.org/project/message_subscribe/issues/2928789

zanvidmar’s picture

Version: 8.x-4.0-alpha2 » 8.x-4.x-dev
Category: Support request » Bug report
StatusFileSize
new464 bytes

In my case. The issue was that $account was not null but $session_id was.
That being said. Here is the patch that check if both variables (account and session_id) are null

turtletrail’s picture

#13 did the trick for me.
thanks!

turtletrail’s picture

updating my last reply, #13 should not be applied. See problem description: https://www.drupal.org/project/flag/issues/3075108#comment-13224836

martinma’s picture

Hm,

I get it on /user/register and not at other pages (as it seem now for me) ...

I had the whole message stack installed too, so maybee there is a relation.

After uninstalling Message Digest UI:

Error: Call to undefined function message_digest_allowed_values_callback() in options_allowed_values() (Line 89 in /core/modules/options/options.module)

After
Message Subcribe Email
Message Subscribe UI
Message Subscribe

same Error as above

After unistalling Message Digest:

Error: Call to a member function getPath() on null in Drupal\config_translation\ConfigNamesMapper->getOverviewRoute() (Line 247 in /core/modules/config_translation/src/ConfigNamesMapper.php)

and for anonymous users:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "message_digest_interval" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (Line 150 in /core/lib/Drupal/Core/Entity/EntityTypeManager.php).

/user/register still doesnt work!

martinma’s picture

Priority: Normal » Major
martinma’s picture

I wonder how this issue can be closed if it is not fixed!

If new users cant register, its major for me!

martinma’s picture

Followed instruction of https://www.drupal.org/project/message_digest/issues/3095573 and removed field.storage.user.message_digest and also field.storage.user.message_subscribe_email. Register still doesnt work, same error message related to message module ...

zanvidmar’s picture

@turtletrail got it right patch #13 should not be used. The problem in first place in my case wast that anonymous users should not have acces to content where flag is used. I fix this with redirect to login path.

zanvidmar’s picture

Anonymous’s picture

I encountered the same problem on a test D8 installation.

I deleted the Message Subscribe module's flags for term and user (so, just leaving its content flag), and this *appears* to have resolved the problem with the registration page.

Fortunately for me, I only need the content flag.

Sharing just in case somebody else has the same use case.

hansrossel’s picture

Project: Flag » Message Subscribe
Version: 8.x-4.x-dev » 8.x-1.x-dev
Component: Flag core » Code

Moving this issue to the right project.

This patch is needed to fix it:
https://github.com/hdpe/message_subscribe/commit/9ca5e6082640b088087ae04...

perfectcu.be’s picture

Here's @hansrossel's patch in cweagans/composer-patches consumable form. Note that I applied his patch to the 1.1 version, not 8.x-1.x-dev as originally specified by @hansrossel.

New to cweagans/composer-patches?
Add something like this to your composer.json:

{
  "extra": {
    "patches": {
      "drupal/message_subscribe":{
        "LogicException: An anonymous user must be identifed by session ID, https://www.drupal.org/project/message_subscribe/issues/2880521#comment-14186786":"https://www.drupal.org/files/issues/2021-10-03/message_subscribe-1.1.0--2880521-24--anonymous-user-must-be-identifed-by-session-id_flag-compatibility-issue.patch"
      }
    }
  }
}
drupalbubb’s picture

Patch #24 works. Maintainers, please change the status to something else.

socialnicheguru’s picture

avpaderno’s picture

Title: LogicException: An anonymous user must be identifed by session ID. » "LogicException: An anonymous user must be identifed by session ID."
Version: 8.x-1.1 » 8.x-1.x-dev

This issue has been moved, but since it's closed, it won't probably be noticed. (I just found it because I was looking at the recently posted comments.)

It's probably better to open a new issue with the details useful to the maintainers of this project.

avpaderno’s picture

Status: Closed (fixed) » Closed (duplicate)
Related issues: -#3075108: Working with another user flags

(Actually, as comment #26 says, there is already an issue opened for this.)

pearls’s picture

Status: Closed (duplicate) » Active

The issue mentioned in #26 seems to be closed, but the main problem mentioned above still persists when an anonymous user visits the site.
Tested versions
Drupal : 10.3.2
Message Subscribe : 8.x-1.3
Flag: 8.x-4.x-dev

LogicException: An anonymous user must be identified by session ID. in Drupal\flag\FlagService->getAllEntityFlaggings() (line 223 of /var/www/html/d10site/web/modules/contrib/flag/src/FlagService.php).
#0 /var/www/html/d10site/web/modules/contrib/message_subscribe/message_subscribe_email/message_subscribe_email.module(46): Drupal\flag\FlagService->getAllEntityFlaggings()
#1 [internal function]: message_subscribe_email_flag_action_access()
#2 /var/www/html/d10site/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array()
#3 /var/www/html/d10site/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#4 /var/www/html/d10site/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(415): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#5 /var/www/html/d10site/web/modules/contrib/flag/src/FlagType/FlagTypeBase.php(175): Drupal\Core\Extension\ModuleHandler->invokeAll()
#6 /var/www/html/d10site/web/modules/contrib/flag/src/Plugin/Flag/EntityFlagType.php(315): Drupal\flag\FlagType\FlagTypeBase->actionAccess()
#7 /var/www/html/d10site/web/modules/contrib/flag/src/Plugin/Flag/UserFlagType.php(145): Drupal\flag\Plugin\Flag\EntityFlagType->actionAccess()
#8 /var/www/html/d10site/web/modules/contrib/flag/src/Entity/Flag.php(343): Drupal\flag\Plugin\Flag\UserFlagType->actionAccess()
#9 /var/www/html/d10site/web/modules/contrib/flag/src/ActionLink/ActionLinkTypeBase.php(99): Drupal\flag\Entity\Flag->actionAccess()
#10 /var/www/html/d10site/web/modules/contrib/flag/src/Plugin/ActionLink/AJAXactionLink.php(80): Drupal\flag\ActionLink\ActionLinkTypeBase->getAsFlagLink()
#11 /var/www/html/d10site/web/modules/contrib/flag/src/FlagLinkBuilder.php(55): Drupal\flag\Plugin\ActionLink\AJAXactionLink->getAsFlagLink()
#12 /var/www/html/d10site/web/modules/contrib/flag_anon/src/FlagAnonLinkBuilder.php(87): Drupal\flag\FlagLinkBuilder->build()
#13 [internal function]: Drupal\flag_anon\FlagAnonLinkBuilder->build()
#14 /var/www/html/d10site/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#15 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#16 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(411): Drupal\Core\Render\Renderer->doCallback()
#17 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#18 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render()
#19 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#20 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(164): Drupal\Core\Render\Renderer->executeInRenderContext()
#21 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(191): Drupal\Core\Render\Renderer->renderInIsolation()
#22 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(723): Drupal\Core\Render\Renderer->doRenderPlaceholder()
#23 [internal function]: Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#24 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(731): Fiber->start()
#25 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(608): Drupal\Core\Render\Renderer->replacePlaceholders()
#26 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#27 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(153): Drupal\Core\Render\Renderer->render()
#28 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#29 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(152): Drupal\Core\Render\Renderer->executeInRenderContext()
#30 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(288): Drupal\Core\Render\Renderer->renderRoot()
#31 /var/www/html/d10site/web/core/modules/big_pipe/src/Render/BigPipeResponseAttachmentsProcessor.php(74): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders()
#32 /var/www/html/d10site/web/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments()
#33 [internal function]: Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond()
#34 /var/www/html/d10site/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#35 /var/www/html/d10site/vendor/symfony/http-kernel/HttpKernel.php(214): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#36 /var/www/html/d10site/vendor/symfony/http-kernel/HttpKernel.php(202): Symfony\Component\HttpKernel\HttpKernel->filterResponse()
#37 /var/www/html/d10site/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#38 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#39 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#40 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#41 /var/www/html/d10site/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#42 /var/www/html/d10site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#43 /var/www/html/d10site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#44 /var/www/html/d10site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#45 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#46 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#47 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#48 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#49 /var/www/html/d10site/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#50 /var/www/html/d10site/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#51 {main}
pearls’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

There is a loop between the issues. Each one references each other and at the end of the day, it does not provide any solution. There is no different situation for Version 2. The problem still persists.By the way, patch in #24 is not applied and does not work.

jmester13’s picture

StatusFileSize
new986 bytes

I have re-rolled the existing patch as some new code as been added.

bluegeek9’s picture

  • bluegeek9 committed bec8787c on 2.0.x
    Issue #2880521 by bluegeek9, zanvidmar, jmester13, perfectcu.be: "...
bluegeek9’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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