min-todo icon indicating copy to clipboard operation
min-todo copied to clipboard

Type error from NextApiHandler

Open n-glaz opened this issue 2 years ago • 1 comments

This is a really cool repo, thank you for the Clerk/trpc integration example!

I get the following error on yarn build, yarn dev still runs well though:

./src/pages/api/trpc/[trpc].ts:10:3
Type error: Argument of type 'NextApiHandler<any>' is not assignable to parameter of type 'Middleware'.
  Types of parameters 'req' and 'req' are incompatible.
    Property 'env' is missing in type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>> & { auth: { sessionId: string | null; userId: string | null; getToken: ServerGetToken; claims: ClerkJWTClaims | null; }; }' but required in type 'NextApiRequest'.

   8 | 
   9 | export default withAuth(
> 10 |   trpcNext.createNextApiHandler({
     |   ^
  11 |     export default trpcNext.createNextApiHandler({
  12 |       router: appRouter,
  13 |       /**

n-glaz avatar Aug 08 '22 20:08 n-glaz

Hey there, i tried to reproduce the problem, but it works fine for me. I suspect you are missing one of your env keys. Please, check them again.

ogzhanolguncu avatar Aug 17 '22 09:08 ogzhanolguncu