Skip to main content
James_Grubb1
Jun 23, 2023 2:59 PM UTC
Question

Network requests

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
Sep 6, 2024 11:37 AM UTC

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