You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I dont know why, but I keep getting these empty inline "data-emotion" style tags ..
setting the style-src directive as "style-src 'self' 'sha256-2NO5...' 'sha256-47DE...';" with the full hashes from the emotion library works. but i dont wanna bind the csp header to this settings. i reckon the hashes change with future mui versions.
Expected behavior 🤔
no data-emotion inline style tags
Context 🔦
I dont use server-side-rendering.
I upload the build output files directly to my aws cloudfront instance.
Chiming in to say we ran into this as well using chakra-ui. The hash that the console is giving you, sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= is the hash for an empty string. You can verify this with the following:
As you note, you can specify the hash in the CSP and things work. It looks like you have another inline style at the top which is not empty and has a different hash.
This issue #1248 discusses what the empty tags are and why they exist.
For the time being, we've added this empty string hash to our style-src directive in the CSP. It seems nonsensical to me, but it is better than unsafe-inline.
I faced the same error message in browser console after update of
yarn from 3.2.1 to 3.4.1
@emotion/cache from 11.7.1 to 11.10.5
@emotion/react from 11.8.1 to 11.10.6
Error message:
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-1ffqgqw45634t3gad=='". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution.
After a couple days and some refreshes, Empty Cache and Hard Reload + deleting yarn.lock and reinstalling all packages, the error is not thrown anymore.
Steps to reproduce 🕹
Link to live example:
Steps:
Current behavior 😯
I dont know why, but I keep getting these empty inline "data-emotion" style tags ..
setting the style-src directive as "style-src 'self' 'sha256-2NO5...' 'sha256-47DE...';" with the full hashes from the emotion library works. but i dont wanna bind the csp header to this settings. i reckon the hashes change with future mui versions.
Expected behavior 🤔
no data-emotion inline style tags
Context 🔦
I dont use server-side-rendering.
I upload the build output files directly to my aws cloudfront instance.
Your environment 🌎
npx @mui/envinfo
using chrome and edge
The text was updated successfully, but these errors were encountered: