Open jh-chee opened 1 year ago
Probably there is error in example, try to create you custom server handler from scratch based on NewDefaultServer method, like this:
s := handler.New(schema)
s.AddTransport(transport.Websocket{
KeepAlivePingInterval: 10 * time.Second,
})
s.AddTransport(transport.Options{})
s.AddTransport(transport.GET{})
s.AddTransport(transport.POST{})
s.AddTransport(transport.MultipartForm{MaxUploadSize: 1000 * (1 << 20)})
s.SetQueryCache(lru.New(1000))
s.Use(extension.Introspection{})
s.Use(extension.AutomaticPersistedQuery{
Cache: lru.New(100),
})
In example NewDefaultServer already adds MultipartForm transport, and when you adds second one it not used in request.
thx @atzedus it works for me. I just have to increase the MaxMemory
too
mb := int64(1 << 20)
graphQueryHandler.AddTransport(transport.MultipartForm{
MaxUploadSize: 50 * mb,
MaxMemory: 50 * mb,
})
What happened?
This is similiar to #1780.
I was trying out the file upload example and set the
MaxUploadSize
to 1 GB underserver/server.go
.I then uploaded a file with size of 576 MB. The error message was
{"errors":[{"message":"failed to parse multipart form, request body too large"}],"data":null}
.What did you expect?
The upload for 576 MB should be successful based on the configuration set.
I tried again with a 31 MB file and the upload was successful. The hard limit seems to be at 32 MB.
Minimal graphql.schema and models to reproduce
Schema is based from file upload example.
versions
go run github.com/99designs/gqlgen version
?: v0.17.20go version
?: go1.18.4 linux/amd64