#Unable to create a caller function on my nextjs app and trpc server backend
1 messages · Page 1 of 1 (latest)
Based on the knowledge sources provided, it seems you're trying to create a caller function using tRPC in your Next.js application. Here's an example of how you might do this:
import { headers } from "next/headers";
import { appRouter } from "~/server/api/root";
import { db } from "~/server/db";
import { auth } from "@clerk/nextjs";
export const api = appRouter.createCaller({
db,
headers: headers(),
auth: auth(),
});
In this example, appRouter.createCaller is used to create a caller function. The db, headers, and auth objects are passed as arguments to the createCaller function. The headers function is imported from next/headers, and auth is imported from @clerk/nextjs.
Please note that this is a general example and you might need to adjust it according to your specific use case and the structure of your application.
For more information, you can refer to the following sources:
- Github Issue (closed): Runtime Edge throws an "Invariant: Method expects to have requestAsyncStorage, none available" (https://github.com/vercel/next.js/issues/52176)
- Github Issue (open): Unable to manage state and server side render at the same time (https://github.com/vercel/next.js/issues/61364)