Skip to main content

This is the code I am using to convert the image URL


  const imageData = await fetch(data.coverURL);
const imageArrayBuffer = await imageData.arrayBuffer();
const imageUint8Array = new Uint8Array(imageArrayBuffer);
// Create a new image in the Figma document
const imageHash = figma.createImage(imageUint8Array).hash;
console.log('Image hash:', imageHash);

and here is the URL


https://is1-ssl.mzstatic.com/image/thumb/Publication6/v4/60/29/a3/6029a31a-bf59-43fb-3a29-23ff12d8631d/Cover_BellsBigMove.jpg/800x800bb.jpg

Getting this error


VM4198:6 Refused to connect to 'https://cors-anywhere.herokuapp.com/https://is1-ssl.mzstatic.com/image/thum…/6d6c0fd5-0d8b-df53-5a2c-1d349e0ed9b3/617513652833_cover.jpg/500x500bb.jpg' because it violates the following Content Security Policy directive: "default-src data: blob:". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

Hey @Rohit_Rajan, thank you for reaching out!

I’ve reached out internally to the teams for help, I’ll come back to you once I have more information.


Appreciate your patience in the meantime!


Hey @Rohit_Rajan, I’ve got the following response from the team:


You need to add any domains you’re planning to fetch from to the networkAccess.allowedDomains field in your manifest.json file.


“networkAccess”: { “allowedDomains”: D “https://is1-ssl.mzstatic.com”, “https://cors-anywhere.herokuapp.com” ] }


Have you tried using the createImageAsync API method? createImageAsync | Plugin API


Let me know if this helps!


Reply