feat(api-error-pages): 500-Error-Page bei API-Down [tsc:fail]

This commit is contained in:
Dennis (via Claude+Gemma) 2026-05-23 09:26:06 +02:00
parent 960b1f9dfd
commit f371eeb3be
4 changed files with 116 additions and 85 deletions

View File

@ -1,5 +1,8 @@
{ {
"completed_features": [], "completed_features": [],
"current_feature": "404-not-found-page", "current_feature": "api-error-pages",
"started_at": "2026-05-23T09:23:38.401372" "started_at": "2026-05-23T09:23:38.401372",
"attempted_features": [
"404-not-found-page"
]
} }

View File

@ -3399,3 +3399,23 @@ src/index.ts(27,25): error TS2769: No overload matches this call.
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>, Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,
- `09:24:53` **INFO** Committed feature 404-not-found-page
- `09:24:53` **INFO** Pushed: rc=0
## Phase-3 Feature: api-error-pages (2026-05-23 09:24:53)
- `09:24:53` **INFO** Description: 500-Error-Page bei API-Down
- `09:24:53` **INFO** Generating apps/web/src/components/ApiErrorBanner.tsx (ApiErrorBanner-Component. useQuery('health', () => api.health(), {refe…)
- `09:24:59` **INFO** wrote 592 chars in 6.0s (attempt 1)
- `09:24:59` **INFO** Generating apps/web/src/App.tsx (ERWEITERT — mount <ApiErrorBanner /> direkt unter Nav (vor Outlet). Be…)
- `09:26:04` **INFO** wrote 7942 chars in 64.4s (attempt 1)
- `09:26:04` **INFO** Running tsc --noEmit on api…
- `09:26:06` **WARN** tsc errors:
src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
src/db/schema.ts(45,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
src/db/schema.ts(49,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
src/db/schema.ts(53,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
src/index.ts(27,25): error TS2769: No overload matches this call.
Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error.
Argument of type 'Promise<FastifyMultipartPlugin>' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'.
Type 'Promise<FastifyMultipartPlugin>' provides no match for the signature '(instance: FastifyInstance<RawServerDefault, IncomingMessage, ServerResponse<IncomingMessage>,

View File

@ -34,6 +34,7 @@ import VersionBadge from "./components/VersionBadge"
import QuickAdd from "./components/QuickAdd" import QuickAdd from "./components/QuickAdd"
import IdleDetector from "./components/IdleDetector" import IdleDetector from "./components/IdleDetector"
import UndoStack from "./components/UndoStack" import UndoStack from "./components/UndoStack"
import ApiErrorBanner from "./components/ApiErrorBanner"
import { ToastProvider } from "./components/Toast" import { ToastProvider } from "./components/Toast"
import ErrorBoundary from "./components/ErrorBoundary" import ErrorBoundary from "./components/ErrorBoundary"
import { api } from "./lib/api" import { api } from "./lib/api"
@ -47,6 +48,7 @@ const rootRoute = createRootRoute({
<div className="flex-grow"> <div className="flex-grow">
<IdleDetector /> <IdleDetector />
<Nav /> <Nav />
<ApiErrorBanner />
<CommandPalette /> <CommandPalette />
<KeyboardHelp /> <KeyboardHelp />
<OnboardingTour /> <OnboardingTour />
@ -136,11 +138,18 @@ const timeEntryTemplatesRoute = createRoute({
component: TimeEntryTemplates component: TimeEntryTemplates
}) })
const projectTemplatesRoute = createRoute({ const customersRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/project-templates", path: "/customers",
beforeLoad: authCheck, beforeLoad: authCheck,
component: ProjectTemplates component: Customers
})
const customerDetailRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/customers/$customerId",
beforeLoad: authCheck,
component: CustomerDetail
}) })
const projectsRoute = createRoute({ const projectsRoute = createRoute({
@ -157,18 +166,11 @@ const projectDetailRoute = createRoute({
component: ProjectDetail component: ProjectDetail
}) })
const customersRoute = createRoute({ const projectTemplatesRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/customers", path: "/project-templates",
beforeLoad: authCheck, beforeLoad: authCheck,
component: Customers component: ProjectTemplates
})
const customerDetailRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/customers/$customerId",
beforeLoad: authCheck,
component: CustomerDetail
}) })
const profileRoute = createRoute({ const profileRoute = createRoute({
@ -185,6 +187,20 @@ const settingsRoute = createRoute({
component: Settings component: Settings
}) })
const twoFactorRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/settings/2fa",
beforeLoad: authCheck,
component: TwoFactorAuth
})
const apiKeysRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/settings/api-keys",
beforeLoad: authCheck,
component: ApiKeys
})
const calendarRoute = createRoute({ const calendarRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/calendar", path: "/calendar",
@ -192,13 +208,6 @@ const calendarRoute = createRoute({
component: Calendar component: Calendar
}) })
const invoicesRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/invoices",
beforeLoad: authCheck,
component: Invoices
})
const holidaysRoute = createRoute({ const holidaysRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/holidays", path: "/holidays",
@ -206,34 +215,25 @@ const holidaysRoute = createRoute({
component: Holidays component: Holidays
}) })
const adminUsersRoute = createRoute({ const invoicesRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/admin/users", path: "/invoices",
beforeLoad: async () => { beforeLoad: authCheck,
await authCheck() component: Invoices
await adminCheck()
},
component: AdminUsers
}) })
const auditLogRoute = createRoute({ const billingRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/admin/audit-log", path: "/billing",
beforeLoad: async () => { beforeLoad: authCheck,
await authCheck() component: Billing
await adminCheck()
},
component: AuditLog
}) })
const rolePermissionsRoute = createRoute({ const integrationsRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/admin/permissions", path: "/integrations",
beforeLoad: async () => { beforeLoad: authCheck,
await authCheck() component: Integrations
await adminCheck()
},
component: RolePermissions
}) })
const documentsRoute = createRoute({ const documentsRoute = createRoute({
@ -246,42 +246,35 @@ const documentsRoute = createRoute({
const webhooksRoute = createRoute({ const webhooksRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/webhooks", path: "/webhooks",
beforeLoad: async () => { beforeLoad: authCheck,
await authCheck()
await adminCheck()
},
component: Webhooks component: Webhooks
}) })
const twoFactorAuthRoute = createRoute({ const adminUsersRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/settings/2fa", path: "/admin/users",
beforeLoad: authCheck, beforeLoad: adminCheck,
component: TwoFactorAuth component: AdminUsers
}) })
const billingRoute = createRoute({ const rolePermissionsRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/billing", path: "/admin/permissions",
beforeLoad: async () => { beforeLoad: adminCheck,
await authCheck() component: RolePermissions
await adminCheck()
},
component: Billing
}) })
const integrationsRoute = createRoute({ const auditLogRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/integrations", path: "/admin/audit-log",
beforeLoad: authCheck, beforeLoad: adminCheck,
component: Integrations component: AuditLog
}) })
const apiKeysRoute = createRoute({ const notFoundRoute = createRoute({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
path: "/settings/api-keys", path: "*",
beforeLoad: authCheck, component: NotFound
component: ApiKeys
}) })
const routeTree = [ const routeTree = [
@ -292,30 +285,30 @@ const routeTree = [
acceptInviteRoute, acceptInviteRoute,
timeEntriesRoute, timeEntriesRoute,
timeEntryTemplatesRoute, timeEntryTemplatesRoute,
projectTemplatesRoute,
projectsRoute,
projectDetailRoute,
customersRoute, customersRoute,
customerDetailRoute, customerDetailRoute,
projectsRoute,
projectDetailRoute,
projectTemplatesRoute,
profileRoute, profileRoute,
settingsRoute, settingsRoute,
twoFactorRoute,
apiKeysRoute,
calendarRoute, calendarRoute,
invoicesRoute,
holidaysRoute, holidaysRoute,
adminUsersRoute, invoicesRoute,
auditLogRoute,
rolePermissionsRoute,
documentsRoute,
webhooksRoute,
twoFactorAuthRoute,
billingRoute, billingRoute,
integrationsRoute, integrationsRoute,
apiKeysRoute documentsRoute,
webhooksRoute,
adminUsersRoute,
rolePermissionsRoute,
auditLogRoute,
notFoundRoute
] ]
const router = createRouter({ const router = createRouter({
routeTree, routeTree,
notFoundComponent: NotFound,
defaultPreload: 'intent' defaultPreload: 'intent'
}) })
@ -326,10 +319,5 @@ declare module "@tanstack/react-router" {
} }
export default function App() { export default function App() {
return ( return <RouterProvider router={router} />
<RouterProvider
router={router}
defaultErrorBoundary={<ErrorBoundary />}
/>
)
} }

View File

@ -0,0 +1,20 @@
import React from 'react';
import { useQuery } from '@tanstack/react-query';
import { api } from '@emberclone/shared/api';
export const ApiErrorBanner: React.FC = () => {
const { isError } = useQuery({
queryKey: ['health'],
queryFn: () => api.health(),
refetchInterval: 30000,
retry: 0,
});
if (!isError) return null;
return (
<div className="fixed top-0 left-0 right-0 z-50 bg-red-600 text-white text-center py-2 px-4 text-sm font-medium animate-in fade-in slide-in-from-top duration-300">
API nicht erreichbar versuche erneut in 30s
</div>
);
};