faro-web-sdk icon indicating copy to clipboard operation
faro-web-sdk copied to clipboard

Session_id not getting updated in iframe

Open smallcatpd opened this issue 1 year ago • 4 comments

Description

The session_id does not get updated in iframe which causes traces / events / logs sent from within an iframe to have the initial session_id value even though it already got updated due to e.g. inactivity. It doesn’t seem to matter whether the persistent or volatile sessions are being used. May be related to: https://github.com/grafana/faro-web-sdk/issues/267

Steps to reproduce

  • Have a page that sends traces / logs / events via e.g. a button click.
  • Add an iframe that embeds this exact page
  • Send data from outside of the iframe
  • Send data from within the iframe
  • Compare the session ids - they should match
  • Wait for a session to timeout e.g. due to 15min inactivity
  • Send data again and compare the session_ids:
    • The one from outside of the iframe will have a new session_id
    • The one from within the iframe will have the initial session_id

Expected behavior

  • session_id should get updated in both cases

Actual behavior

  • session_id in iframe does not get updated

Environment

  • SDK version: "@grafana/faro-web-sdk": "^1.8.1"
  • SDK instrumentations: SessionInstrumentation
  • Device type: Desktop
  • Device name: Macbook
  • OS: MacOS
  • Browser: Chrome

Demo

Logs sent from outside of iframe after session update: Zrzut ekranu 2024-07-8 o 12 06 36 Logs sent from within iframe after session update: Zrzut ekranu 2024-07-8 o 12 07 16 Traces sent from outside of iframe after session update: Zrzut ekranu 2024-07-8 o 12 07 46 Traces sent from within iframe after session update: Zrzut ekranu 2024-07-8 o 12 07 32

Context

smallcatpd avatar Jul 08 '24 10:07 smallcatpd