Closed akselele closed 7 months ago
Seems like I had a wrong configuration for my tRPC Plugin. I was importing httpBatchLink
from @trpc/client
instead of from trpc-nuxt/client
. But my question about custom providers still stands because it was quite unclear from the docs.
Environment
Reproduction
This is more of a question rather than a bug (yet), so I'll omit the reproduction for now.
Describe the bug
Hi, I'm using Nuxt 3, tRPC, Prisma and Nuxt-Auth with a custom OAuth provider. When using the default providers, it's stated in the docs that we need to use the
<provider>.default({...})
, but what about custom providers? The comment states// @ts-expect-error You need to use .default here for it to work during SSR. May be fixed via Vite at some point
and I think I'm getting a session SSR issue. I can log in and log out, but with an authMiddleware in tRPC like followingFor every call to a
authMiddleware
procedure, I get an UNAUTHORIZED, even when I am logged in and have the correct tokens in my session / cookie. But here is the weird thing: whenever editing anything on the client-side of the app and hot reload, those auth protected calls suddenly work (only one call though). This is why I think this issue is related to the<provider>.default({...})
part.I'm not sure whether this is a bug (not even this package, might also be tRPC-Nuxt) or a mistake on my part. If this is a bug I will investigate further and file a proper bug report.
Additional context
server/api/auth/[...].ts
No response
Logs
No response