Theo's Typesafe CultTTC
Theo's Typesafe Cult3y ago
3 replies
Less

TRPC and protectedProcedure with next-auth

Has anyone ever experienced an issue with a new t3 app with next-auth and trpc where a protectedProcedure for a mutation stays pending and multiple session requests are also pending when you're signed in?

I've also added a log to the middleware on the enforceUserIsAuthed and it never seems to get called.
Also, when this happens I have to remove the .next folder and start the dev server again, otherwise clearing the site data and hard refreshing doesn't even load the page anymore.

The procedure works when it's a publicProcedure

test: protectedProcedure.mutation(({ ctx }) => {
    console.log("ctx", ctx);
    return { data: ctx.session.user, status: 200 };
  }),
Was this page helpful?