diff --git a/skyvern-frontend/src/store/useClientIdStore.ts b/skyvern-frontend/src/store/useClientIdStore.ts index b31e4dd9..8fc81545 100644 --- a/skyvern-frontend/src/store/useClientIdStore.ts +++ b/skyvern-frontend/src/store/useClientIdStore.ts @@ -1,10 +1,20 @@ import { create } from "zustand"; +import { nanoid } from "nanoid"; type ClientIdStore = { clientId: string; }; -const initialClientId = crypto.randomUUID(); +const generateClientId = (): string => { + try { + return crypto.randomUUID(); + } catch (error) { + // if crypto.randomUUID() fails, use nanoid as a fallback + return nanoid(); + } +}; + +const initialClientId = generateClientId(); export const useClientIdStore = create(() => ({ clientId: initialClientId,