Skip to main content
James_Grubb1
June 23, 2023
Question

Network requests

  • June 23, 2023
  • 1 reply
  • 405 views

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 replies.

1 reply

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