-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Sentry 7.73.0 causes styled-components
to fail to render with styles/CSS
#9170
Comments
If you add SDK version cc @billyvg. |
Yes - 7.72.0 worked fine with Sentry.Replay() active. If I upgrade to 7.73.0 - with Replay - then it affects the UI as I've shown above. Running 7.73.0 w/o Replay solved the UI issue and UI was no longer affected. Thank you for taking a look. |
@jornncc Just to clarify, Replay is causing regressions on your production app and not in the replay, correct? I have not had any luck so far creating a repro, would you be able to help us create one here? https://codesandbox.io/s/upbeat-cloud-y35pzz |
We also just hit this issue and had to rollback to 7.72.0. We don't use Grommet, but we do use Styled Components. I didn't debug too deeply, but it does look like a bunch of styled components seemed to lose their styling with 7.73.0. |
We use Grommet but also found the issue to be tied to styled-components, not necessarily anything with Grommet. In our NextJs app it looks like our styled-components ssr without styles. |
Thanks -- I'll take a look at this today with a focus on styled-components and SSR. |
Hi, I don’t know if this relates to these problems, but after switching to 7.73.0 in my project, many users have such errors due to rrweb. I don't use SSR. As far as I can see it does not affect the interface.
|
Just wanted to +1 this. Been trying to debug an issue of some styled components not being styled. We had We're using React 17.0.2, styled-components 5.3.0. Let me know if I can be of any further use. I took a screen recording of what I was seeing that I was going to send through to my Sentry contact. |
Just wanted to chime in and report that we are also seeing this issue in production using |
Can you send it to me as well please? billy at sentry.io Can anyone provide an example styled component snippet that is losing its styles? I've tested some basic styled components usage and am not able to reproduce the issue. |
styled-components
to fail to render with styles/CSS
So I was able to kind of reproduce it where the replay is missing the styles, but the production application still maintains them. I'm hoping this is the root cause for both cases of the bug. For those that were affected, do you know if the replay that was captured have the CSS applied? |
Our replay ran out so actually didn’t get a chance to see what the actual affects on replays were 😵 |
We did not get a sentry replay because there was no error generated, however we did see the css styles missing in our e2e test replay on cypress as well as in production so it doesn't affect just the sentry replays. The strange thing is that we could only reproduce the issue when navigating between pages using react router. The initial landing page of our app (login) had the correct styles, but after logging in the next page (dashboard) had partially missing styles. A browser reload would clear the issue and cause the styles to load on dashboard. |
Additionally, in case it helps with reproduction we are using styled-components v5.3.11 and unable to update to v6 |
As far as I can see it does not affect the interface. ../../node_modules/@sentry-internal/rrweb/es/rrweb/packages/rrweb/src/record/observer.js in initAdoptedStyleSheetObserver at line 532:1 const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget {snip} This problem at least should be fixed by: getsentry/rrweb#110, hard to say if that is also the cause of some of the other problems 🤔 |
I've just been setting up an environment to create this problem again and it may be useful for people to know that it wasn't 7.73 alone that caused it. I also had to enable replays. |
Thanks folks, especially @marksweb for the repro environment -- we've figured out the issue: in our SDK we were aggressively catching exceptions so that they don't bubble up into your projects, in doing so we were catching exceptions that the styled-components library was relying when a rule would fail to be inserted (i.e. chrome will throw on unsupported, browser specific pseudo selectors). Any rules following that would fail to be inserted because of an out of bounds index error. We'll be releasing a patch for this ASAP. Thanks again for your reports and sorry for the issues this caused. |
NOTE: This requires a bump to rrweb library Fixes an issue where the Replay integration can potentially break applications that use `styled-components`. `styled-components` [relies on an exception being throw](https://github.com/styled-components/styled-components/blob/b7b374bb1ceff1699f7035b15881bc807110199a/packages/styled-components/src/sheet/Tag.ts#L32-L40) for CSS rules that are not supported by the browser engine. However, our SDK suppresses any exceptions thrown from within rrweb, so `styled-components` assumes that an unsupported rule was inserted successfully and increases a rule index, which causes following inserted rules to fail due to an out-of-bounds error. getsentry/rrweb#111 introduces a change the adds metadata to exceptions that occur when calling `insertRule`, and this PR will re-throw those exceptions that will then bubble up to `styled-components`. Fixes #9170
NOTE: This requires a bump to rrweb library Fixes an issue where the Replay integration can potentially break applications that use `styled-components`. `styled-components` [relies on an exception being throw](https://github.com/styled-components/styled-components/blob/b7b374bb1ceff1699f7035b15881bc807110199a/packages/styled-components/src/sheet/Tag.ts#L32-L40) for CSS rules that are not supported by the browser engine. However, our SDK suppresses any exceptions thrown from within rrweb, so `styled-components` assumes that an unsupported rule was inserted successfully and increases a rule index, which causes following inserted rules to fail due to an out-of-bounds error. getsentry/rrweb#111 introduces a change the adds metadata to exceptions that occur when calling `insertRule`, and this PR will re-throw those exceptions that will then bubble up to `styled-components`. Fixes #9170
Fixes an issue where the Replay integration can potentially break applications that use `styled-components`. `styled-components` [relies on an exception being throw](https://github.com/styled-components/styled-components/blob/b7b374bb1ceff1699f7035b15881bc807110199a/packages/styled-components/src/sheet/Tag.ts#L32-L40) for CSS rules that are not supported by the browser engine. However, our SDK suppressed any exceptions thrown from within rrweb, so `styled-components` assumes that an unsupported rule was inserted successfully and increases a rule index, which causes following inserted rules to fail due to an out-of-bounds error. This was a regression from v1 as [we were always re-throwing the exception](https://github.com/getsentry/rrweb/blob/sentry-v1/packages/rrweb/src/sentry/callbackWrapper.ts#L17) Fixes #9170 --------- Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
We've just released v7.74.0 which hopefully fixes this issue! Please let us know if you still run into this after updating. Thanks a lot for the patience, and sorry again for the inconvenience. |
Just upgraded to v7.77 and everything looks great - no more unstyled components :-D Thank you for taking care of this issue so far. Glad we could get back to normal dependency update cycle. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/react
SDK Version
7.73.0
Framework Version
React 17.0.2
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
Expected Result
Having Sentry.Replay enabled in v7.73.0 should not affect the webapp ui Grommet Components.
Actual Result
Please see screenshots above (steps to reproduce) where you will see before upgrading to v7.73.0 and after screenshots.
The text was updated successfully, but these errors were encountered: