New to lightning Web Components and trying to follow a simple tutorial by adding an image to an lwc component. When I deploy it to the org, I get an error on the browser:

Refused to load the image because it violates the following Content Security Policy directive: "img-src 'self' data: blob:


<img src="https://s3-us-west-1.amazonaws.com/sfdc-demo/people/amy_taylor.jpg" alt="Profile photo">

I have explored other answers but I do not understand. Solution 1: https://stackoverflow.com/questions/59484216/refused-to-load-the-image-blob-because-it-violates-the-following-content-s

Where to add

<meta http-equiv="Content-Security-Policy" 
      worker-src blob:; 
      child-src blob: gap:;
      img-src 'self' blob: data:;
      default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">

to fix this?

Solution2: https://www.youtube.com/watch?v=nf7eqg9WWPg&t=261s

I have no server.js in scripts folder

Newbie here, please be patient with your answers.

1 Answer 1


login to salesforce -> Go to set up -> csp trusted site -> create new record -> add your url -> select the below content as needed and click save

Hopefully this will resolve your error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .