feat(api-error-pages): 500-Error-Page bei API-Down [tsc:fail]
This commit is contained in:
parent
960b1f9dfd
commit
f371eeb3be
@ -1,5 +1,8 @@
|
||||
{
|
||||
"completed_features": [],
|
||||
"current_feature": "404-not-found-page",
|
||||
"started_at": "2026-05-23T09:23:38.401372"
|
||||
"current_feature": "api-error-pages",
|
||||
"started_at": "2026-05-23T09:23:38.401372",
|
||||
"attempted_features": [
|
||||
"404-not-found-page"
|
||||
]
|
||||
}
|
||||
@ -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.
|
||||
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>,
|
||||
- `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>,
|
||||
|
||||
@ -34,6 +34,7 @@ import VersionBadge from "./components/VersionBadge"
|
||||
import QuickAdd from "./components/QuickAdd"
|
||||
import IdleDetector from "./components/IdleDetector"
|
||||
import UndoStack from "./components/UndoStack"
|
||||
import ApiErrorBanner from "./components/ApiErrorBanner"
|
||||
import { ToastProvider } from "./components/Toast"
|
||||
import ErrorBoundary from "./components/ErrorBoundary"
|
||||
import { api } from "./lib/api"
|
||||
@ -47,6 +48,7 @@ const rootRoute = createRootRoute({
|
||||
<div className="flex-grow">
|
||||
<IdleDetector />
|
||||
<Nav />
|
||||
<ApiErrorBanner />
|
||||
<CommandPalette />
|
||||
<KeyboardHelp />
|
||||
<OnboardingTour />
|
||||
@ -136,11 +138,18 @@ const timeEntryTemplatesRoute = createRoute({
|
||||
component: TimeEntryTemplates
|
||||
})
|
||||
|
||||
const projectTemplatesRoute = createRoute({
|
||||
const customersRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/project-templates",
|
||||
path: "/customers",
|
||||
beforeLoad: authCheck,
|
||||
component: ProjectTemplates
|
||||
component: Customers
|
||||
})
|
||||
|
||||
const customerDetailRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/customers/$customerId",
|
||||
beforeLoad: authCheck,
|
||||
component: CustomerDetail
|
||||
})
|
||||
|
||||
const projectsRoute = createRoute({
|
||||
@ -157,18 +166,11 @@ const projectDetailRoute = createRoute({
|
||||
component: ProjectDetail
|
||||
})
|
||||
|
||||
const customersRoute = createRoute({
|
||||
const projectTemplatesRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/customers",
|
||||
path: "/project-templates",
|
||||
beforeLoad: authCheck,
|
||||
component: Customers
|
||||
})
|
||||
|
||||
const customerDetailRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/customers/$customerId",
|
||||
beforeLoad: authCheck,
|
||||
component: CustomerDetail
|
||||
component: ProjectTemplates
|
||||
})
|
||||
|
||||
const profileRoute = createRoute({
|
||||
@ -185,6 +187,20 @@ const settingsRoute = createRoute({
|
||||
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({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/calendar",
|
||||
@ -192,13 +208,6 @@ const calendarRoute = createRoute({
|
||||
component: Calendar
|
||||
})
|
||||
|
||||
const invoicesRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/invoices",
|
||||
beforeLoad: authCheck,
|
||||
component: Invoices
|
||||
})
|
||||
|
||||
const holidaysRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/holidays",
|
||||
@ -206,34 +215,25 @@ const holidaysRoute = createRoute({
|
||||
component: Holidays
|
||||
})
|
||||
|
||||
const adminUsersRoute = createRoute({
|
||||
const invoicesRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/admin/users",
|
||||
beforeLoad: async () => {
|
||||
await authCheck()
|
||||
await adminCheck()
|
||||
},
|
||||
component: AdminUsers
|
||||
path: "/invoices",
|
||||
beforeLoad: authCheck,
|
||||
component: Invoices
|
||||
})
|
||||
|
||||
const auditLogRoute = createRoute({
|
||||
const billingRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/admin/audit-log",
|
||||
beforeLoad: async () => {
|
||||
await authCheck()
|
||||
await adminCheck()
|
||||
},
|
||||
component: AuditLog
|
||||
path: "/billing",
|
||||
beforeLoad: authCheck,
|
||||
component: Billing
|
||||
})
|
||||
|
||||
const rolePermissionsRoute = createRoute({
|
||||
const integrationsRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/admin/permissions",
|
||||
beforeLoad: async () => {
|
||||
await authCheck()
|
||||
await adminCheck()
|
||||
},
|
||||
component: RolePermissions
|
||||
path: "/integrations",
|
||||
beforeLoad: authCheck,
|
||||
component: Integrations
|
||||
})
|
||||
|
||||
const documentsRoute = createRoute({
|
||||
@ -246,42 +246,35 @@ const documentsRoute = createRoute({
|
||||
const webhooksRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/webhooks",
|
||||
beforeLoad: async () => {
|
||||
await authCheck()
|
||||
await adminCheck()
|
||||
},
|
||||
beforeLoad: authCheck,
|
||||
component: Webhooks
|
||||
})
|
||||
|
||||
const twoFactorAuthRoute = createRoute({
|
||||
const adminUsersRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/settings/2fa",
|
||||
beforeLoad: authCheck,
|
||||
component: TwoFactorAuth
|
||||
path: "/admin/users",
|
||||
beforeLoad: adminCheck,
|
||||
component: AdminUsers
|
||||
})
|
||||
|
||||
const billingRoute = createRoute({
|
||||
const rolePermissionsRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/billing",
|
||||
beforeLoad: async () => {
|
||||
await authCheck()
|
||||
await adminCheck()
|
||||
},
|
||||
component: Billing
|
||||
path: "/admin/permissions",
|
||||
beforeLoad: adminCheck,
|
||||
component: RolePermissions
|
||||
})
|
||||
|
||||
const integrationsRoute = createRoute({
|
||||
const auditLogRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/integrations",
|
||||
beforeLoad: authCheck,
|
||||
component: Integrations
|
||||
path: "/admin/audit-log",
|
||||
beforeLoad: adminCheck,
|
||||
component: AuditLog
|
||||
})
|
||||
|
||||
const apiKeysRoute = createRoute({
|
||||
const notFoundRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: "/settings/api-keys",
|
||||
beforeLoad: authCheck,
|
||||
component: ApiKeys
|
||||
path: "*",
|
||||
component: NotFound
|
||||
})
|
||||
|
||||
const routeTree = [
|
||||
@ -292,30 +285,30 @@ const routeTree = [
|
||||
acceptInviteRoute,
|
||||
timeEntriesRoute,
|
||||
timeEntryTemplatesRoute,
|
||||
projectTemplatesRoute,
|
||||
projectsRoute,
|
||||
projectDetailRoute,
|
||||
customersRoute,
|
||||
customerDetailRoute,
|
||||
projectsRoute,
|
||||
projectDetailRoute,
|
||||
projectTemplatesRoute,
|
||||
profileRoute,
|
||||
settingsRoute,
|
||||
twoFactorRoute,
|
||||
apiKeysRoute,
|
||||
calendarRoute,
|
||||
invoicesRoute,
|
||||
holidaysRoute,
|
||||
adminUsersRoute,
|
||||
auditLogRoute,
|
||||
rolePermissionsRoute,
|
||||
documentsRoute,
|
||||
webhooksRoute,
|
||||
twoFactorAuthRoute,
|
||||
invoicesRoute,
|
||||
billingRoute,
|
||||
integrationsRoute,
|
||||
apiKeysRoute
|
||||
documentsRoute,
|
||||
webhooksRoute,
|
||||
adminUsersRoute,
|
||||
rolePermissionsRoute,
|
||||
auditLogRoute,
|
||||
notFoundRoute
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
notFoundComponent: NotFound,
|
||||
defaultPreload: 'intent'
|
||||
})
|
||||
|
||||
@ -326,10 +319,5 @@ declare module "@tanstack/react-router" {
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<RouterProvider
|
||||
router={router}
|
||||
defaultErrorBoundary={<ErrorBoundary />}
|
||||
/>
|
||||
)
|
||||
return <RouterProvider router={router} />
|
||||
}
|
||||
20
apps/web/src/components/ApiErrorBanner.tsx
Normal file
20
apps/web/src/components/ApiErrorBanner.tsx
Normal 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>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user