Describe the bug
I am using t3-app and I would like to check the user's role in the trpc`s middleware.
I added an auth object this way
const auth = getAuth(opts.req as RequestLike);
Unfortunately the user in the auth object is undefined. Is it a bug, or I need some additional coding to get the user object and role in privateMetadata?
Is it the same issue in the next middleware, in the withClerkMiddleware() function.
const { user, userId, } = getAuth(request);
User object is undefined.
To Reproduce
Expected behavior
User object is populated.
Logs
Please provide logs showing the error.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: windows 11
- Browser chrome
- Version 117
- NodeJS 20.6.3
- Nextjs 13.5.2
- CreateT3app 7.20.2
- "@trpc/server": "^10.38.3",
- "@clerk/nextjs": "^4.24.0",
Additional context
Describe the bug
I am using t3-app and I would like to check the user's role in the trpc`s middleware.
I added an auth object this way
Unfortunately the user in the auth object is undefined. Is it a bug, or I need some additional coding to get the user object and role in privateMetadata?
Is it the same issue in the next middleware, in the withClerkMiddleware() function.
User object is undefined.
To Reproduce
Expected behavior
User object is populated.
Logs
Please provide logs showing the error.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context