-
-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multipart_uploads_enabled not propagated in AsyncGraphQLView, causing file uploads to fail #3713
Comments
Hi @BranDavidSebastian, I'm having a hard time reproducing this. We have (passing) tests for this and I just created an example repository containing a minimal (working) demo for this. Can you take a look at the demo repository and confirm I understood your issue/setup correctly? Besides that only two things come to my mind at this point:
|
Hello @DoctorJohn. thank you for the example repository and the help. After I played it for a while and started to set up closer to my actual environment I realized I forgot to mention an essential detail in the initial issue: I’m using Strawberry in an ASGI + Channels+Daphne setup. I’ve forked your example to show, step by step, how we can end up with “Unsupported content type” in that environment here. In essence the big difference is the asgi.py that looks like this:
After installing Channels and Daphne, you’ll see the issue. I noticed that in AuthGraphQLProtocolTypeRouter:
So requests end up at GraphQLHTTPConsumer, where multipart_uploads_enabled defaults to False if it isn’t passed (and is never passed). Since they never reach AsyncGraphQLView, the file upload config doesn’t apply, leading to the error. For a fix I found out that the most straight forward one will be to be able to config the multipart_uploads_enabled inside the AuthGraphQLProtocolTypeRouter like this:
And then we can simply config like this:
It works well but requires setting multipart_uploads_enabled in two places, which might not be ideal. I’m not entirely familiar with the codebase, so there may be a better approach Thank you for your assistance! I’m looking forward to getting this resolved, as it’s currently blocking a major Strawberry upgrade release in one of our projects. In the worst-case scenario, we can override the AuthGraphQLProtocolTypeRouter in our project until the fix is applied in the main repository. Please let me know if there’s anything I can do to help and sorry again for the time lost due to my oversight in not mentioning the ASGI part. |
Describe the Bug
In strawberry-graphql==0.253.0 and strawberry-graphql-django==0.50.0, setting multipart_uploads_enabled=True in the AsyncGraphQLView does not enable multipart uploads as expected. The self.multipart_uploads_enabled attribute remains False, causing file uploads via multipart/form-data to fail with a 400 Bad Request error.
To Reproduce
Example cURL Command:
Expected Behavior
Setting multipart_uploads_enabled=True should set self.multipart_uploads_enabled to True in the AsyncGraphQLView, enabling multipart uploads and allowing file uploads to work correctly.
Actual Behavior
Despite setting multipart_uploads_enabled=True, self.multipart_uploads_enabled remains False, causing the server to reject multipart/form-data requests.
Additional Context
If I force it to True in this method everthing works fine:
Question
Am I misconfiguring something, or is this a bug in strawberry-graphql? Any guidance on how to fix or work around this issue would be appreciated.
The text was updated successfully, but these errors were encountered: