Operation GenerateSessionToken timed out after 30000ms

I’m doing a fetch call using relative urls in my POS extension (see code below)

Most of the time it works, but sometimes, some of our merchants get an Operation GenerateSessionToken timed out after 30000ms error. Where does this error come from, can we fix it?

function pollFiscalStatus() {

      fetch(`/pos-ui-ext/api/v2/get-pos-device-fiscal-status?shopifyDeviceIdShort=${shopify.device.registerName}`)

        .then((response) => {

if (!response.ok) {

throw new Error(`HTTP error! status: ${response.status}`);

          }

return response.json();

        })

        .then((data: FiscalStatusData) => {

setResult({ status: "success", data });

        })

        .catch((error) => {

console.error("Error getting pos device fiscal status:", error);

setResult({

status: "error",

error: error instanceof Error ? error : new Error(String(error)),

          });

        });

    }
1 Like

I’m not sure but that call looks incorrect for a POS UI extension. In POS you shouldn’t call your backend directly without a session token. The extension should first call session.getSessionToken() and send it in the Authorization header when doing fetch.