Web Pixel Cookie doesn't set or read cookie

So the way my extensions work is by sending an event through fetch, and checking if there’s cookie already (by reading the cookie and returning it if it’s already exist) then returning a new id if there’s none. The code is basically like this.

const pixelRequest = async (event_body) => {
    const currentClientId = await browser.cookie.get("client_id");

    const params = new URLSearchParams();
    params.append("shop", settings["shop"]);
    console.log(`Current client id: ${currentClientId}`);
    if (currentClientId && currentClientId.length > 1)
      params.append("client_id", currentClientId);

    const fetchResult = await fetch(
      `https://${backend}/pixel?` + params.toString(),
      {
        method: "POST",
        body: JSON.stringify(event_body),
        headers: {
          "content-type": "application/json",
        },
        keepalive: true,
        credentials: "include",
      }
    );

    if (fetchResult.status === 200) {
      const clientId = await fetchResult.text();
      console.log(`Setting Cookies: ${clientId}`);
      await browser.cookie.set(clientId);
    }
  };

The function is called for every events. The backend should return new client id if there’s none set in the cookies already. Example of the text response from backend is below

client_id=10d92070-8a4a-4896-bed2-11068285e1f4; Domain=redacted-domain.com; SameSite=None; Secure

But even after calling the browser.cookie.set, when it is called on browser.cookie.get it always returns empty. Is there any problem to my code or is it something wrong with shopify api?

Thank you,

Fauzan