type-graphql-series icon indicating copy to clipboard operation
type-graphql-series copied to clipboard

Context is empty when File Uploads

Open ssdk86 opened this issue 5 years ago • 4 comments

Hi Ben, Thanks for a Great tutorial! Have a question according to video File Uploads TypeGraphQL https://www.youtube.com/watch?v=s35EmAn9Zl8

So in addProfilePicture we cannot use @UseMiddleware(isAuth, logger) because @Ctx() ctx: MyContext is empty? it is possible to send context?

ssdk86 avatar Aug 13 '19 12:08 ssdk86

I don't think the context should be empty, is it empty in your resolver too?

benawad avatar Aug 13 '19 14:08 benawad

@benawad, yes, it is empty in my resolver. And when I testing query from graphql playground (without GraphQLUpload @Arg) ctx is NOT empty. Maybe we have that resault because PostMan cannot send Context since it(postman) have not access to it?

ssdk86 avatar Aug 13 '19 14:08 ssdk86

@benawad, sorry I incorrectly described the problem. context is not empty. empty cookies that I set in ctx.req.cookies

ssdk86 avatar Aug 13 '19 15:08 ssdk86

cookies work with file uploads, so there's something slightly off with your setup

benawad avatar Aug 15 '19 00:08 benawad