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 };
}),
test: protectedProcedure.mutation(({ ctx }) => {
console.log("ctx", ctx);
return { data: ctx.session.user, status: 200 };
}),
2 Replies
craigcaski
craigcaski9mo ago
did you ever figure this out? I'm having this issue too. OK, so for anyone wondering you can't console.log ctx or it just freezes up...
Sachin Mittal
Sachin Mittal5mo ago
Hey did you guys figure out the way?