From d8d27b6729c7cd2c16c9b2fc73b8dc4611078637 Mon Sep 17 00:00:00 2001 From: Joshua Melville Date: Fri, 19 Jan 2024 16:23:19 +0200 Subject: [PATCH] fix tRPC request type --- app/api/trpc/[trpc]/route.ts | 4 ++-- server/context.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/api/trpc/[trpc]/route.ts b/app/api/trpc/[trpc]/route.ts index e3a1c219..e3e4e587 100644 --- a/app/api/trpc/[trpc]/route.ts +++ b/app/api/trpc/[trpc]/route.ts @@ -2,10 +2,10 @@ import { fetchRequestHandler } from '@trpc/server/adapters/fetch'; import { env } from '~/env.mjs'; import { appRouter } from '~/server/router'; import { createTRPCContext } from '~/server/context'; -import type { NextApiRequest, NextApiResponse } from 'next'; +import type { NextApiResponse } from 'next'; import { trackEvent } from '~/analytics/utils'; -const handler = (req: NextApiRequest, res: NextApiResponse) => +const handler = (req: Request, res: NextApiResponse) => fetchRequestHandler({ endpoint: '/api/trpc', req, diff --git a/server/context.ts b/server/context.ts index 82e20ae9..dce1b7a5 100644 --- a/server/context.ts +++ b/server/context.ts @@ -1,5 +1,4 @@ import type { Session } from 'lucia'; -import type { NextRequest } from 'next/server'; import { auth } from '~/utils/auth'; import * as context from 'next/headers'; @@ -15,7 +14,7 @@ export const createInnerTRPCContext = (opts: CreateContextOptions) => { }; }; -export const createTRPCContext = async (opts: { req: NextRequest }) => { +export const createTRPCContext = async (opts: { req: Request }) => { // Fetch stuff that depends on the request const authRequest = auth.handleRequest(opts.req.method, context);