Fetch with headers doesn't work

Seem like whenever I add headers to the sandbox fetch in checkout ui extension, it causes cors issue. When I remove them it works as expected. May I know why this is happening?

eg. this doesnt work

    const postPurchaseOffer = await fetch(`${APP_URL}/api/offer`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${inputData.token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({data}),
    }).then((response) => response.json());

but this works

    const postPurchaseOffer = await fetch(`${APP_URL}/api/offer`, {
      method: "POST",
      body: JSON.stringify({data}),
    }).then((response) => response.json());

Is your server configured to allow *.shopify.com OPTIONS requests with the CORS headers?

Hi @Dylan
Do you know how to configured to allow *.shopify.com OPTIONS requests with the CORS headers?

Hi @zensein
Did you alredy fixed this issue, because I’m facing same error.