whoa - so much - new features (UPC,etc) - Sentry for app logging! so much more !
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 1m10s

This commit is contained in:
2026-01-11 19:05:43 -08:00
parent f6c0c082bc
commit 11aeac5edd
82 changed files with 23503 additions and 110 deletions

View File

@@ -3,6 +3,16 @@ import { Profile, ShoppingListItem, SearchQuery, Budget, Address } from '../type
import { logger } from './logger.client';
import { eventBus } from './eventBus';
// Sentry integration is optional - only used if @sentry/browser is installed
let Sentry: { setTag?: (key: string, value: string) => void } | null = null;
try {
// Dynamic import would be cleaner but this keeps the code synchronous
// eslint-disable-next-line @typescript-eslint/no-require-imports
Sentry = require('@sentry/browser');
} catch {
// Sentry not installed, skip error tracking integration
}
// This constant should point to your backend API.
// It's often a good practice to store this in an environment variable.
// Using a relative path '/api' is the most robust method for production.
@@ -148,9 +158,14 @@ export const apiFetch = async (
// --- DEBUG LOGGING for failed requests ---
if (!response.ok) {
const requestId = response.headers.get('x-request-id');
if (requestId && Sentry?.setTag) {
Sentry.setTag('api_request_id', requestId);
}
const responseText = await response.clone().text();
logger.error(
{ url: fullUrl, status: response.status, body: responseText },
{ url: fullUrl, status: response.status, body: responseText, requestId },
'apiFetch: Request failed',
);
}
@@ -272,6 +287,12 @@ export const checkDbPoolHealth = (): Promise<Response> => publicGet('/health/db-
*/
export const checkRedisHealth = (): Promise<Response> => publicGet('/health/redis');
/**
* Fetches the health status of the background job queues.
* @returns A promise that resolves to the queue status object.
*/
export const getQueueHealth = (): Promise<Response> => publicGet('/health/queues');
/**
* Checks the status of the application process managed by PM2.
* This is intended for development and diagnostic purposes.