import { initTRPC } from "@trpc/server";import type { CreateAWSLambdaContextOptions } from "@trpc/server/adapters/aws-lambda";import { awsLambdaRequestHandler } from "@trpc/server/adapters/aws-lambda";import type { APIGatewayProxyEvent } from "aws-lambda";function createContext({ event,}: CreateAWSLambdaContextOptions<APIGatewayProxyEvent>) { return { event: event, apiVersion: (event as { version?: string }).version ?? "1.0", user: event.headers["x-user"], };}type Context = Awaited<ReturnType<typeof createContext>>;const t = initTRPC.context<Context>().create();const router = t.router;const appRouter = router(...);export type AppRouter = typeof appRouter;export const handler = awsLambdaRequestHandler({ router: appRouter, createContext,});