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

Session_id not getting updated in iframe #643

Open
smallcatpd opened this issue Jul 8, 2024 · 4 comments
Open

Session_id not getting updated in iframe #643

smallcatpd opened this issue Jul 8, 2024 · 4 comments
Labels
bug Report a bug

Comments

@smallcatpd
Copy link

smallcatpd commented Jul 8, 2024

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: #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 smallcatpd added the bug Report a bug label Jul 8, 2024
@codecapitano
Copy link
Collaborator

Hi @smallcatpd

  • Do both documents share the same origin or are they from different origins?
  • Does each (parent page/iframe) use a separate Faro instance?

Browsing contexts (like the parent page and the nested iframe) can only access resources in another if they share the same origin (protocol, host, and port).

@smallcatpd
Copy link
Author

Hi @codecapitano

Yes they share the same origin and use same faro instance.

@codecapitano
Copy link
Collaborator

All right thanks. Do you use the NPM or CDN version?

@smallcatpd
Copy link
Author

All right thanks. Do you use the NPM or CDN version?

NPM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report a bug
Projects
None yet
Development

No branches or pull requests

2 participants