Skip to main content
Question

Network requests

  • June 23, 2023
  • 1 reply
  • 350 views

James_Grubb1

Hi im trying to implement the code on Figmas fetch to the console example but getting cors errors. I’ve added the domain to the list of allowed domains.

Fetch to the console
(async () => {
  const response = await fetch('https://httpbin.org/get?success=true')
  const json = await response.json()

  console.log(JSON.stringify(json.args, null, 2))

  figma.closePlugin()
})()
``` any ideas would be great.
This topic has been closed for comments

zhang
  • September 6, 2024

How to add domain to allowed domains? I use “fetch” but getting “Refused to connect to ‘http://open.bigmodel.cn/api/paas/v4/chat/completions’ 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.” in console


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings