Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix page overlay sidebar authentication failure #18538

Closed
bx80 opened this issue Dec 23, 2021 · 0 comments · Fixed by #18648
Closed

Fix page overlay sidebar authentication failure #18538

bx80 opened this issue Dec 23, 2021 · 0 comments · Fixed by #18648
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@bx80
Copy link
Contributor

bx80 commented Dec 23, 2021

When viewing the page overlay, on some sites, the sidebar may fail to authenticate and shows the following message:

Error: Your session has expired due to inactivity

When this happens the AJAX call to the renderSidebar controller method is sent with a different session cookie than all the other requests which causes the API request to fail as the session is not authenticated.

See L3-197

Expected Behavior

The page overlay sidebar should consistently use the currently logged in session and not show an error.

Current Behavior

The page overlay sidebar intermittently fails to use the current session and loads with an error.

Possible Solution

If a Javascript breakpoint is added to Piwik_Overlay.js at line 33 (the beginning of the loadSidebar() method) and execution is immediately continued when that breakpoint is hit, then loadSidebar() sends the correct cookie and the error does not occur. As soon as the breakpoint is removed the session expired error returns on the next reload.

It appears to be some sort of race condition where loadSidebar() somehow executes before the session cookie is available and the small delay introduced by the breakpoint prevents this happening.

Adding a small delay to the loadSidebar() call might fix this, but to confirm the fix this issue would need to be recreated in development environment first.

Steps to Reproduce (for Bugs)

This is hard to recreate and has only been seen on one site so far.

  1. Go to Behaviour > Pages
  2. Choose a page url and click the 'Open Page Overlay' row action
  3. In the new tab that opens the sidebar will display the 'session has expired' error

Context

This prevents usage of the page overlay feature for affected sites.

Your Environment

  • Matomo Version: 4.6.2
  • Matomo cloud
  • Browser: Firefox, Chromium
  • Operating System: Linux, MacOs
@bx80 bx80 added the Bug For errors / faults / flaws / inconsistencies etc. label Dec 23, 2021
@sgiehl sgiehl linked a pull request Jan 18, 2022 that will close this issue
11 tasks
@sgiehl sgiehl self-assigned this Feb 14, 2022
@sgiehl sgiehl added this to the 4.8.0 milestone Feb 14, 2022
@justinvelluppillai justinvelluppillai changed the title Page overlay sidebar authentication failure Fix page overlay sidebar authentication failure Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
2 participants