# Getting CORS ERROR while calling GraphQL API

**URL:** <https://community.shopify.com/t/getting-cors-error-while-calling-graphql-api/614945>\
**Category:** Technical Q&A\
**Tags:** troubleshooting\
**Created:** [April 27, 2026, 3:45pm UTC](https://community.shopify.com/t/getting-cors-error-while-calling-graphql-api/614945 "2026-04-27T15:45:10Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![saurabhv](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@saurabhv](https://community.shopify.com/u/saurabhv)\
**Post date:** [April 27, 2026, 3:45pm UTC](https://community.shopify.com/t/getting-cors-error-while-calling-graphql-api/614945/1 "2026-04-27T15:45:10Z")

</div>

I’m getting CORS error while calling Shopify GraphQL Admin API.

```auto
async function getMetafield(product_id) {

  const res = await fetch("https://mystore.myshopify.com/admin/api/2025-07/graphql.json", {

    method: "POST",

    headers: { 

      "Content-Type": "application/json",

      "X-Shopify-Access-Token": ""

    },

    body: JSON.stringify({

      query: `

        {

          product(id: "gid://shopify/Product/${product_id}") {

            metafields(first: 10) {

              edges {

                node {

                  namespace

                  key

                  value

                }

              }

            }

          }

        }

      `

    })

  });

```

---

_[View the full topic](https://community.shopify.com/t/getting-cors-error-while-calling-graphql-api/614945)._
