Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ The App uses Sentry to track crashes and application errors so we can diagnose a

When an error occurs, Sentry receives the error/crash message and stack trace, along with diagnostic details about failed requests to your Open WebUI server: the HTTP status and method, the request path (the server’s domain/host is stripped and never sent), and the request/response body. Body content is length-truncated, and any fields that may contain conversation text (such as content, message, text, or prompt) are redacted before being sent.

Every Sentry report includes the version number your Open WebUI server reports for itself. It is updated whenever the App loads the server configuration, including when you switch servers.

We do not send your chat content, AI prompts or responses, or your Open WebUI server’s address/domain to Sentry.

## Google Sign-In (Optional)
Expand Down
15 changes: 0 additions & 15 deletions libs/shared/data-access/api-client/src/utils/capture-api-error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Sentry from '@sentry/react-native';
import { AxiosError, isAxiosError } from 'axios';
import { queryClient } from '@open-webui-react-native/shared/data-access/query-client';
import { stripOrigin } from '@open-webui-react-native/shared/utils/strings';
import { ApiErrorData } from '../types';

Expand Down Expand Up @@ -94,22 +93,12 @@ const getRequestUrl = (error: AxiosError): string | undefined => {
return url;
};

const getApiInstanceMeta = (): { apiVersion?: string } => {
const configuration = queryClient.getQueryData<{ version?: string }>(['config']);

return {
apiVersion: configuration?.version,
};
};

export type CaptureApiErrorParams = {
operation: string;
context?: Record<string, unknown>;
};

export const captureApiError = (error: unknown, { operation, context = {} }: CaptureApiErrorParams): void => {
const { apiVersion } = getApiInstanceMeta();

if (isAxiosError(error)) {
const axiosError = error as AxiosError<ApiErrorData>;
const { config, response } = axiosError;
Expand All @@ -119,11 +108,9 @@ export const captureApiError = (error: unknown, { operation, context = {} }: Cap
scope.setTag('api.operation', operation);
scope.setTag('http.status_code', String(status ?? 'unknown'));
scope.setTag('http.method', config?.method ?? 'unknown');
scope.setTag('api.version', apiVersion ?? 'unknown');
scope.setLevel('error');

scope.setContext('api', {
apiVersion,
url: getRequestUrl(axiosError),
method: config?.method,
status,
Expand All @@ -145,8 +132,6 @@ export const captureApiError = (error: unknown, { operation, context = {} }: Cap

Sentry.withScope((scope) => {
scope.setTag('api.operation', operation);
scope.setTag('api.version', apiVersion ?? 'unknown');
scope.setContext('api', { apiVersion });
scope.setContext('api_request', sanitizeContextForSentry(context));
Sentry.captureException(error);
});
Expand Down
9 changes: 8 additions & 1 deletion libs/shared/data-access/api/src/lib/app-configuration/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as Sentry from '@sentry/react-native';
import { useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
import { AxiosError } from 'axios';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { refetchOnMountWithStaleCheck } from '@open-webui-react-native/shared/data-access/persist-query-helpers';
import { queryClient } from '@open-webui-react-native/shared/data-access/query-client';
import { appConfigurationApiConfig } from './config';
Expand Down Expand Up @@ -56,6 +57,12 @@ export function useGetAppConfiguration(
}
};

useEffect(() => {
if (result.isSuccess) {
Sentry.setTag('api.version', result.data?.version);
}
}, [result.isSuccess, result.data?.version]);

return {
...result,
fetchWithUrlResult,
Expand Down
Loading