Session_id not getting updated in iframe
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:
Logs sent from within iframe after session update:
Traces sent from outside of iframe after session update:
Traces sent from within iframe after session update:
Context
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).
Hi @codecapitano
Yes they share the same origin and use same faro instance.
All right thanks. Do you use the NPM or CDN version?
All right thanks. Do you use the NPM or CDN version?
NPM