Jenkins giving Javascript error on Robot Framework reports

I was struggling with an issue with Jenkins and Robot Framework. After a test run I could open the results file but not report.html nor log.html. They failed with a strange JavaScript error, even though that javascript was enabled.

A colleague pointed me towards the issue JENKINS-32118 which showed that the issue was related to Content Security Policy (CSP). The workaround mentioned was to disable csp, however that seemed a bit extreme.

Robert Saric posted to say how it could be disabled in a default install.

Under RHEL/CentOS you can edit your Jenkins startup configuration to add the option suggested:

# diff /etc/sysconfig/jenkins.orig /etc/sysconfig/jenkins
47c47
< JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
---
> JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=false"

A restart later and you should be back in business.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.