@sentry/browser
5.0.8
While using example setup for angular, I get error
Refused to apply inline style because it violates the following Content Security Policy directive: "style-src ...
. I tried adding nonce to the sentry script tag and also added sha256- from the error message but it still occured.
My setup was easy, followed instructions on your page.
https://docs.sentry.io/platforms/javascript/angular/#angularjs-1x -> used the standalone part.
Also added urls following your CSP :
https://forum.sentry.io/t/required-content-security-policy/4484 -> updated the script-src value to add https://browser.sentry-cdn.com
Error traces back to:
sentryWrapped | @ | helpers.ts:84
that is:
return fn.apply(this, wrappedArguments);
So just to make clear, you fixed this by adding unsafe-inline
?
Yes, that fixed it
Since this isn't really a bug with the SDK I will close this issue. I hope people running into this will find the issue. Adding this to the docs is also not crystal clear since the solution heavily depends on your individual setup.
@HazAT, I'll try to find the cause of this problem and when I get my head around it, I'll post the info in here :)
I get the same error when I try to display the User Feedback Dialog! As a workaround, we're just going to load the CSS manually.
A way to tell Sentry not to inline the CSS through a loadStyles
param would be great to avoid this issue:
Sentry.showReportDialog({
eventId: 0,
loadStyles: false
});
@hugmanrique this would have to be implemented inside Sentry itself first, as the SDK just includes a script which then creates an iframe. https://github.com/getsentry/sentry
Most helpful comment
A way to tell Sentry not to inline the CSS through a
loadStyles
param would be great to avoid this issue: