Skip to content

Commit

Permalink
fix tRPC request type
Browse files Browse the repository at this point in the history
  • Loading branch information
jthrilly committed Jan 19, 2024
1 parent 04ac35b commit d8d27b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/api/trpc/[trpc]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions server/context.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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);
Expand Down

0 comments on commit d8d27b6

Please sign in to comment.