I have a SAP UI5 app deployed to BTP – Cloud Foundry env.
The app was working fine, but suddenly I started getting the following error:
ModuleError: Failed to execute 'sap/suite/ui/commons/ChartContainer.js': Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src * data: blob:".
It is an overview page with some charts. I didn’t change anything that could have caused the issue.
The issue is present even after updating the ui5 version to the latest “1.124.0”.
I need to mention that I only get this error when open the app inside the SAP Build Work Zone.
When I open the same app in HTML5 Applications in the BTP Cockpit, the app opens fine.
Here is the index.html – if that’s relevant:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<style>
html, body, body > div, #container, #container-uiarea {
height: 100%;
}
</style>
<script
id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/1.120.12/resources/sap-ui-core.js"
data-sap-ui-theme="sap_fiori_3"
data-sap-ui-resourceroots='{
"test-reporting-app": "."
}'
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-preload="async"
data-sap-ui-libs="sap.m">
</script>
</head>
<body class="sapUiBody sapUiSizeCompact" id="content">
<div data-sap-ui-component data-name="test-reporting-app" data-id="container" data-settings='{"id" : "test-reporting-app"}' data-handle-validation="true"></div>
</body>
</html>
Does anyone knows what could have happened so that I have started getting this error – without making any new changes?