Skip to content
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

[sam2][demo][1/x] Fix file upload #364

Merged
merged 1 commit into from
Oct 8, 2024
Merged

[sam2][demo][1/x] Fix file upload #364

merged 1 commit into from
Oct 8, 2024

Conversation

raedle
Copy link
Contributor

@raedle raedle commented Oct 8, 2024

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in #361. A forward fix is to add multipart_uploads_enabled=True to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

Request

curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]

Response

{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}

@ronghanghu
Copy link
Contributor

ronghanghu commented Oct 8, 2024

Thanks for the fix!

Should we also update the Strawberry version in setup.py to be "strawberry-graphql>=0.243.0"? (Otherwise the multipart_uploads_enabled parameter might not be available since it's newly introduced in strawberry-graphql/strawberry@37265b2, and users might get an error if they are running an older version of strawberry-graphql)

(I think we can either use a loose version of "strawberry-graphql>=0.243.0" or pin it to a strict version like "strawberry-graphql~=0.246")

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in #361. A forward fix is to add `multipart_uploads_enabled=True` to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

*Request*

```
curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]
```

*Response*

```
{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}
```
Copy link
Contributor

@ronghanghu ronghanghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and adding a minor comment about the version in setup.py.

@raedle raedle merged commit c98aa6b into main Oct 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants