TRPCClientError: fetch failed
127.0.0.1
500 Fetch Failed
const handleTRPC: Handle = async ({ event, resolve }) => { if (event.request.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "*", }, }); }; if (event.url.pathname.startsWith(`${trpcPathBase}/`)) { const response = await fetchRequestHandler({ endpoint: trpcPathBase, req: event.request, router: appRouter, createContext: () => { return createContext(event); }, }); response.headers.append("Access-Control-Allow-Origin", "*"); return response; }; // eslint-disable-next-line no-return-await return await resolve(event);};
// public.tsimport type { ContextType } from "./context";import { initTRPC } from "@trpc/server";const t = initTRPC.context<ContextType>().create();export const middleware = t.middleware;export const router = t.router;
+page.server.ts