Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
tsx 94 lines 2.99 KB
Raw
1 import Link from 'next/link';
2 import { headers } from 'next/headers';
3
4 async function log404ToDatadog(path: string, referer: string | null) {
5 const apiKey = process.env.DD_API_KEY;
6 if (!apiKey) return;
7
8 try {
9 await fetch('https://http-intake.logs.datadoghq.com/api/v2/logs', {
10 method: 'POST',
11 headers: {
12 'Content-Type': 'application/json',
13 'DD-API-KEY': apiKey,
14 },
15 body: JSON.stringify([
16 {
17 ddsource: 'composio-docs',
18 ddtags: 'env:production,service:docs,status:404',
19 hostname: 'docs.composio.dev',
20 message: `404 Not Found: ${path}`,
21 service: 'docs',
22 status: 'warn',
23 path,
24 referer,
25 },
26 ]),
27 });
28 } catch {
29 // Silently fail - don't break the 404 page
30 }
31 }
32
33 export default async function NotFound() {
34 const headersList = await headers();
35 const referer = headersList.get('referer');
36 const path =
37 headersList.get('x-pathname') || headersList.get('x-invoke-path') || 'unknown';
38
39 // Fire and forget - don't block rendering
40 log404ToDatadog(path, referer);
41
42 return (
43 <div className="relative flex min-h-[85vh] flex-col items-center justify-center overflow-hidden px-4">
44 {/* Faint giant background 404 */}
45 <div
46 aria-hidden="true"
47 className="pointer-events-none absolute inset-0 flex select-none items-center justify-center text-fd-foreground/[0.04] dark:text-white/[0.04]"
48 style={{
49 fontSize: 'clamp(200px, 30vw, 500px)',
50 fontWeight: 500,
51 lineHeight: 1,
52 letterSpacing: '-0.04em',
53 }}
54 >
55 404
56 </div>
57
58 {/* Foreground glitch 404 */}
59 <h1
60 aria-label="404 — Page not found"
61 className="animate-glitch-404 relative font-sans text-[96px] font-medium leading-none tracking-tighter text-fd-foreground sm:text-[128px]"
62 >
63 404
64 </h1>
65
66 <div className="relative mt-6 text-center max-w-md">
67 <h2 className="font-mono text-sm uppercase tracking-[-0.28px] text-fd-muted-foreground">
68 Page not found
69 </h2>
70 <p className="mt-3 font-mono text-sm leading-relaxed text-fd-muted-foreground">
71 The page you&apos;re looking for doesn&apos;t exist or has moved.
72 <br />
73 <span className="text-fd-muted-foreground/70">
74 Press{' '}
75 <kbd className="mx-1 rounded border border-fd-border bg-fd-muted px-1.5 py-0.5 font-mono text-[10px]">
76 ⌘K
77 </kbd>{' '}
78 to search.
79 </span>
80 </p>
81 </div>
82
83 <div className="relative mt-8">
84 <Link
85 href="/docs"
86 className="group inline-flex items-center gap-1.5 bg-[var(--composio-brand)] px-4 py-2.5 font-mono text-sm uppercase tracking-[-0.28px] text-white no-underline transition-colors hover:bg-[#0006a8]"
87 style={{ color: '#ffffff' }}
88 >
89 <span style={{ color: '#ffffff' }}>Back to docs</span>
90 </Link>
91 </div>
92 </div>
93 );
94 }