🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { createNextApiHandler } from "@trpc/server/adapters/next";
import { createTRPCContext } from "@/src/server/api/trpc";
import { appRouter } from "@/src/server/api/root";
import { env } from "@/src/env.mjs";
import { reportTRPCError } from "@/src/server/utils/trpc-utils";
export const config = {
maxDuration: 240,
api: {
bodyParser: {
sizeLimit: "4.5mb",
},
},
};
// export API handler
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
// Allow queries to be sent as POST. The client does this for `*.batchIO`
// I/O queries (opt-in via `sendAsPostOption`) and for any query whose
// serialized GET URL would exceed `MAX_TRPC_GET_URL_BYTES` (wide filters,
// per-row id lists). This flag is handler-wide (tRPC has no per-procedure
// option), but it only widens the accepted method for queries (read-only);
// mutations remain POST-only, so the GET-mutation protection is unchanged.
allowMethodOverride: true,
onError: reportTRPCError,
responseMeta() {
return {
headers: {
"x-build-id": env.NEXT_PUBLIC_BUILD_ID,
},
};
},
// as `any` workaround for Next.js 15.5+ compatibility with tRPC, probably fixed in Next.js 15.6+
// Related: https://discord-questions.trpc.io/m/1409997624492294276
}) as any;