Session id is not getting generated for Anon user

Created on 25 August 2023, about 1 year ago
Updated 28 August 2023, about 1 year 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

Postponed: needs info

Version

10.0

Component
User module 

Last updated 1 day ago

Created by

🇮🇳India ashetkar

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

Comments & Activities

  • Issue created by @ashetkar
  • Status changed to Postponed: needs info about 1 year ago
  • 🇺🇸United States cilefen

    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();
    }

  • 🇺🇸United States cilefen

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

Production build 0.71.5 2024