Session id is not getting generated for Anon user

Created on 25 August 2023, about 1 year ago
Updated 13 September 2024, 2 months ago

Hi there,

I am using session_manager service to generate anon user id but below service
\Drupal::service('session_manager')->getId() is generating session ID but once cache cleared id is not getting generated.

🐛 Bug report
Status

Closed: cannot reproduce

Version

11.0 🔥

Component
User module 

Last updated about 18 hours ago

Created by

🇮🇳India ashetkar

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.

  • Issue created by @ashetkar
  • Status changed to Postponed: needs info about 1 year ago
  • As a bug report this needs much more detail and steps to reproduce. If there is custom code we must see all of it to identify the bug in Drupal.

  • 🇮🇳India ashetkar

    @cilefen, Please find below custom code which we are using to generate anon user session ID. But once we clear drupal cache it is not generating again.

    function custom_page_attachments(array &$page) {
    page['#attached']['session_id'] = \Drupal::service('session_manager')->getId();
    }

  • A common reason for this kind of thing is missing cache contexts in custom code.

  • Status changed to Closed: cannot reproduce 2 months ago
  • 🇦🇺Australia pameeela

    No additional info provided so I'm closing this, if anyone is able to reproduce it please update the issue summary with steps.

Production build 0.71.5 2024