From 0b26c16ea02e621fdc8dc6f91e217b8455a646b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D0=B8=D0=B9=20=D0=95=D0=BB?= =?UTF-8?q?=D0=B8=D1=81=D0=B5=D0=B5=D0=B2?= Date: Mon, 14 Sep 2026 11:33:05 +0600 Subject: [PATCH 1/2] fix: add more sentry logs for cookies error --- libs/shared/data-access/cookie/src/service.ts | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/libs/shared/data-access/cookie/src/service.ts b/libs/shared/data-access/cookie/src/service.ts index 30ac0cdb..49f4f9e1 100644 --- a/libs/shared/data-access/cookie/src/service.ts +++ b/libs/shared/data-access/cookie/src/service.ts @@ -1,17 +1,33 @@ +import * as Sentry from '@sentry/react-native'; import NitroCookies from 'react-native-nitro-cookies'; import { getApiUrl } from '@open-webui-react-native/shared/utils/config'; class CookieService { - public async setToken(token: string): Promise { + public async setToken(token?: string | null): Promise { + if (!token) { + return; + } + const apiUrl = `${getApiUrl()}/api/`; - await NitroCookies.set(apiUrl, { - name: 'token', - value: token, - path: '/', - secure: true, - httpOnly: false, - }); + try { + await NitroCookies.set(apiUrl, { + name: 'token', + value: token, + path: '/', + secure: true, + httpOnly: false, + }); + } catch (error) { + // NOTE: callers (authState$.signIn, appState$.init) fire this without awaiting it — the real + // auth token already lives in storage and the Authorization header by this point, so this + // cookie is only a best-effort mirror (used by webviews). Report but don't let it surface as + // an unhandled promise rejection. + Sentry.withScope((scope) => { + scope.setTag('cookie.operation', 'setToken'); + Sentry.captureException(error); + }); + } } public async clearAll(): Promise { From 05906a003195b94a6e31fcbf439bc68944f7aaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D0=B8=D0=B9=20=D0=95=D0=BB?= =?UTF-8?q?=D0=B8=D1=81=D0=B5=D0=B5=D0=B2?= Date: Tue, 15 Sep 2026 10:39:37 +0600 Subject: [PATCH 2/2] fix: minor cookies service fix --- libs/shared/data-access/cookie/src/service.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libs/shared/data-access/cookie/src/service.ts b/libs/shared/data-access/cookie/src/service.ts index 49f4f9e1..f2a358ce 100644 --- a/libs/shared/data-access/cookie/src/service.ts +++ b/libs/shared/data-access/cookie/src/service.ts @@ -3,11 +3,7 @@ import NitroCookies from 'react-native-nitro-cookies'; import { getApiUrl } from '@open-webui-react-native/shared/utils/config'; class CookieService { - public async setToken(token?: string | null): Promise { - if (!token) { - return; - } - + public async setToken(token: string): Promise { const apiUrl = `${getApiUrl()}/api/`; try {