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

Inlined CSS from <link> does not work due to CORS #14598

Closed
billyvg opened this issue Dec 5, 2024 · 2 comments
Closed

Inlined CSS from <link> does not work due to CORS #14598

billyvg opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
Package: replay Issues related to the Sentry Replay SDK

Comments

@billyvg
Copy link
Member

billyvg commented Dec 5, 2024

We have a customer that is loading CSS via:

<link rel="stylesheet" href="..." crossorigin />

When we record, what happens is:

  • serialize <link> element, (stylesheet is not loaded in document yet, so this code does not run)
  • stylesheet gets loaded
  • serializeElementNode is called again, this time there is css that is written to _cssText attribute (rel and href attrs are deleted)
    • This is recorded as a mutation to the original link element

During playback:

  • The <link> is added to DOM with origin attributes
  • Browser blocks access to CSS file due to CORS
  • Mutation occurs with _cssText
  • Styles in _cssText are not loaded into DOM

This results in a replay without any CSS loaded.

@billyvg billyvg added the Package: replay Issues related to the Sentry Replay SDK label Dec 5, 2024
@billyvg billyvg self-assigned this Dec 6, 2024
@billyvg
Copy link
Member Author

billyvg commented Dec 6, 2024

Fixed in getsentry/rrweb#226, will require a release + a bump in sentry as this can be fixed on the player side (though there are some enhancements on the SDK side as well).

@billyvg
Copy link
Member Author

billyvg commented Dec 13, 2024

Fixed and released in 8.45.0

@billyvg billyvg closed this as completed Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

No branches or pull requests

1 participant