Closed itsklimov closed 1 month ago
@itsklimov sorry about that! we recently release a change that disabled multipart uploads by default you can see it here: https://strawberry.rocks/docs/breaking-changes/0.243.0
you need to update your view config, here's how can do it with django: https://strawberry.rocks/docs/integrations/django#options (the param should be the same for all the integrations)
I'll keep this open so we can update that doc page :)
as I do not use Django, not much experince with graphql
@itsklimov sorry about that! we recently release a change that disabled multipart uploads by default you can see it here: https://strawberry.rocks/docs/breaking-changes/0.243.0
you need to update your view config, here's how can do it with django: https://strawberry.rocks/docs/integrations/django#options (the param should be the same for all the integrations)
I'll keep this open so we can update that doc page :)
from fastapi import FastAPI, UploadFile, File
from strawberry.fastapi import GraphQLRouter
from src.config import settings
from src.schemas.graphql import schema
from src.utils.logger import logger
async def lifespan(app: FastAPI):
logger.info("GraphQL File Server is starting...")
yield
logger.info("GraphQL File Server is shutting down...")
app = FastAPI(title="GraphQL File Server", lifespan=lifespan)
graphql_app = GraphQLRouter(schema)
app.include_router(graphql_app, prefix="/graphql")
if __name__ == "__main__":
import uvicorn
uvicorn.run(
"app:app",
host=settings.host,
port=settings.port,
reload=True,
)
Can you advice on how to adjust app to enable it?
This should be enough to make it work:
-graphql_app = GraphQLRouter(schema)
+graphql_app = GraphQLRouter(schema, multipart_uploads_enabled=True)
thanks resolved, do you want me to resolve the ticket or leave it opened
let's leave it open, I think we should update the guide
I am trying to make the file upload work and no luck yet I got back to the example on https://strawberry.rocks/docs/guides/file-upload#sending-file-upload-requests but just copy past multi file requests from postman returns "Unsupported content type"
Describe the Bug
System Information
Additional Context
python code
curl --location 'localhost:7675/graphql' \ --form 'operations="{ \"query\": \"mutation(\$files: [Upload!]!) { readFiles(files: \$files) }\", \"variables\": { \"files\": [null, null] } }"' \ --form 'map="{\"file1\": [\"variables.files.0\"], \"file2\": [\"variables.files.1\"]}"' \ --form 'file1=@"/Users/its/Documents/roll.csv"' \ --form 'file2=@"/Users/its/Documents/dump.csv"'
Request Body operations: "{ "query": "mutation($files: [Upload!]!) { readFiles(files: $files) }", "variables": { "files": [null, null] } }" map: "{"file1": ["variables.files.0"], "file2": ["variables.files.1"]}" file1: undefined file2: undefined Response Headers date: Tue, 01 Oct 2024 15:10:58 GMT server: uvicorn content-length: 24 content-type: text/plain; charset=utf-8 Response Body Unsupported content type
response Unsupported content type
Upvote & Fund