-
hello, I'm trying to set up the static export, especially with the search via the app/api/search/route.ts file I configured the file according to the documentation but at the build I have this error
the content of the route.ts file import { source } from "@/utils/content-loader/docs-loader";
import { createFromSource } from "fumadocs-core/search/server";
// it should be cached forever
export const revalidate = false;
console.log("source", source);
console.log("before createFromSource");
console.log("createFromSource", createFromSource(source));
console.log("after createFromSource");
export const { staticGET: GET } = createFromSource(source); the content of the utils/content-loader/docs-loader.ts file
with this logs:
unfortunately I can't share all the source code |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Normally, |
Beta Was this translation helpful? Give feedback.
-
Did you turn on If yes, you need to load all the pages ahead of time: import { source } from '@/lib/source';
import { createSearchAPI } from 'fumadocs-core/search/server';
export const { GET } = createSearchAPI('advanced', {
indexes: await Promise.all(source.getPages().map(async (page) => ({
title: page.data.title,
description: page.data.description,
url: page.url,
id: page.url,
structuredData: (await page.data.load()).structuredData,
}))),
}); Otherwise removing |
Beta Was this translation helpful? Give feedback.
Did you turn on
async
intentionally? It is still an internal feature.If yes, you need to load all the pages ahead of time:
Otherwise removing
async: true
should be able to fix your problem.