trying to access req and res in trpc query

I need to access res to set a header. I tried accessing req and res from ctx but only session and prisma are available. Any ideas? I tried looking it up but didn't really get anywhere
export const filesRouter = router({
getPreSignedUrl: protectedProcedure
.input(
z.object({
fileName: z.string().min(1),
})
)
.query(async ({ ctx, input }) => {
console.log("in");
console.log(ctx);
...
export const filesRouter = router({
getPreSignedUrl: protectedProcedure
.input(
z.object({
fileName: z.string().min(1),
})
)
.query(async ({ ctx, input }) => {
console.log("in");
console.log(ctx);
...
6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
brr
brr2y ago
I did try that tbh but very briefly I took an example from the t3 docs
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
brr
brr2y ago
I can definitely take another crack at it looks solid don’t think I saw this thanks!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
brr
brr2y ago
yeah I will thanks worked ty!, had to modify the CreateContextOptions type too, adding the req and res there .close
Want results from more Discord servers?
Add your server