question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

turf Content Security Policy error

See original GitHub issue

I’m getting the following error when loading turf from the CDN: “https://cdn.jsdelivr.net/npm/@turf/turf@5/turf.min.js

turf.min.js:1 Uncaught EvalError: 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 'self' https:".

    at new Function (<anonymous>)
    at o (turf.min.js:1)
    at turf.min.js:1
    at mt (turf.min.js:1)
    at turf.min.js:1
    at turf.min.js:1
    at turf.min.js:1

Is there a way to get around this issue without having to add ‘unsafe-eval’ to the Content Security Policy. Everything I’ve read indicates adding “unsafe-eval” exposed the application to security risks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
badamscommented, Aug 26, 2021

@rowanwins still seeing this issue on turf 6.5.0

└─┬ @turf/turf@6.5.0
  └─┬ @turf/convex@6.5.0
    └── concaveman@1.2.0
0reactions
el-Rey-magicocommented, Nov 14, 2021

I encounter the same problem as @badams.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Edge Content-security-policy Error - Stack Overflow
It's working fine, now I converted my extension to Microsoft edge extension. and the overall code works except Content security policy block ...
Read more >
How to fix 'because it violates the following content security ...
'because it violates the following content security policy directive' is a browser error message that occurs when Content Security Policy is blocking a ......
Read more >
Fix a content security policy (CSP) error - Affilimate
How to check for content security policy errors. Visit your website, open Chrome Dev Tools, click the Console tab, and check for any...
Read more >
CSP errors and warnings (Content Security Policy) - HTTP
When you see any of the following messages logged in the browser devtools console, it indicates that a problem related to CSP has...
Read more >
Tufts Health Plan: Welcome
At Tufts Health Plan, we're redefining what a health plan can do. Explore information for members, providers, brokers, employers and visitors.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found