@devries-cameron20 / composio Mirror · read-only / commits / 9765275df
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 12:00 UTC

fix(docs): Fix API reference OpenAPI pages not loading

- Update reference page.tsx to use async getReferenceSource() - Update llms.mdx route.ts to use getReferenceSource() for reference prefix - Clean up debug error handler (remove stack trace exposure, use 500 status) The lazy-loaded getReferenceSource() includes both MDX and OpenAPI pages, while the sync referenceSource only includes MDX. This was causing API reference pages generated from OpenAPI spec to not be available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

sohamganatra committed Jan 28, 2026 at 00:27 UTC 9765275df4453bcdc3bb725be23b99a74129d59b
2 files changed +22 -13
docs/app/(home)/reference/[[...slug]]/page.tsx
+7 -3
@@ -1,5 +1,5 @@
1 import type { ComponentType } from 'react';
2 -import { referenceSource, getOgImageUrl } from '@/lib/source';
2 +import { getReferenceSource, getOgImageUrl } from '@/lib/source';
3 import { APIPage } from '@/components/api-page';
4 import {
5 DocsBody,
@@ -25,6 +25,7 @@ export default async function Page({
25 params: Promise<{ slug?: string[] }>;
26 }) {
27 const { slug } = await params;
28 + const referenceSource = await getReferenceSource();
29 const page = referenceSource.getPage(slug);
30 if (!page) notFound();
31
@@ -54,7 +55,8 @@ export default async function Page({
55 <DocsBody>
56 <MDX
57 components={getMDXComponents({
57 - a: createRelativeLink(referenceSource, page),
58 + // eslint-disable-next-line @typescript-eslint/no-explicit-any
59 + a: createRelativeLink(referenceSource as any, page),
60 })}
61 />
62 </DocsBody>
@@ -62,7 +64,8 @@ export default async function Page({
64 );
65 }
66
65 -export function generateStaticParams() {
67 +export async function generateStaticParams() {
68 + const referenceSource = await getReferenceSource();
69 return referenceSource.generateParams();
70 }
71
@@ -85,6 +88,7 @@ export async function generateMetadata({
88 };
89 }
90
91 + const referenceSource = await getReferenceSource();
92 const page = referenceSource.getPage(slug);
93 if (!page) notFound();
94
docs/app/llms.mdx/[[...slug]]/route.ts
+15 -10
@@ -1,6 +1,6 @@
1 import {
2 source,
3 - referenceSource,
3 + getReferenceSource,
4 examplesSource,
5 toolkitsSource,
6 getLLMText,
@@ -374,9 +374,9 @@ async function openapiPageToMarkdown(
374 }
375
376 // Map URL prefixes to their sources
377 +// Note: 'reference' is handled specially below with async getReferenceSource()
378 const sources = [
379 { prefix: 'docs', source },
379 - { prefix: 'reference', source: referenceSource },
380 { prefix: 'examples', source: examplesSource },
381 { prefix: 'toolkits', source: toolkitsSource },
382 ];
@@ -430,14 +430,21 @@ export async function GET(
430 const { slug = [] } = await params;
431 const [prefix, ...rest] = slug;
432
433 - // Find the matching source
434 - const match = sources.find((s) => s.prefix === prefix);
435 - if (!match) notFound();
433 + // Handle 'reference' specially - uses async getReferenceSource() for OpenAPI pages
434 + // eslint-disable-next-line @typescript-eslint/no-explicit-any
435 + let pageSource: any;
436 + if (prefix === 'reference') {
437 + pageSource = await getReferenceSource();
438 + } else {
439 + const match = sources.find((s) => s.prefix === prefix);
440 + if (!match) notFound();
441 + pageSource = match.source;
442 + }
443
444 // Get the page from that source (MDX pages)
445 let page;
446 try {
440 - page = match.source.getPage(rest.length > 0 ? rest : undefined);
447 + page = pageSource.getPage(rest.length > 0 ? rest : undefined);
448 } catch (e) {
449 console.error('Error in getPage:', e);
450 page = null;
@@ -512,12 +519,10 @@ export async function GET(
519 throw e;
520 }
521 console.error('Unexpected error in llms.mdx route:', e);
515 - const errorMessage = e instanceof Error ? e.message : String(e);
516 - const errorStack = e instanceof Error ? e.stack : '';
522 return new Response(
518 - `# Error\n\nAn error occurred while generating the markdown content.\n\n**Error:** ${errorMessage}\n\n**Stack:**\n\`\`\`\n${errorStack}\n\`\`\``,
523 + `# Error\n\nAn error occurred while generating the markdown content.`,
524 {
520 - status: 200, // Return 200 so we can see the error
525 + status: 500,
526 headers: {
527 'Content-Type': 'text/markdown; charset=utf-8',
528 },