99designs / gqlgen

go generate based graphql server library

Home Page:https://gqlgen.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to upload file

KingWu opened this issue · comments

What happened?

Upgrade from 0.13.0 to 0.17.44 and go from 1.16 to 1.22

What did you expect?

Can upload file previously,
but right now throw the following issue

{
	"errors": [
		{
			"message": "failed to parse multipart form"
		}
	],
	"data": null
}

The request body show follow

 POST /portal?lang=en_US HTTP/1.1
> Host: localhost:8080
> User-Agent: insomnia/8.6.1
> Content-Type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY
> Authorization: Bearer xxxxxxxxxx
> Accept: */*
> Content-Length: 3021

| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="operations"
| {"query":"mutation ($file: Upload!) .........
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="map"
| {"0":["variables.file"]}
| --X-INSOMNIA-BOUNDARY
| Content-Disposition: form-data; name="0"; filename="logo.svg"
| Content-Type: image/svg+xml
| <svg width="110" height="44" viewBox="0 0 110 44" ............
| --X-INSOMNIA-BOUNDARY--

versions

  • go run github.com/99designs/gqlgen version? 0.17.44
  • go version? 1.22

Try different go version with gqlgen version

gqlgen v0.17.33 with go v1.18 => Not work
gqlgen v0.17.10 with go v1.16 => Not work
gqlgen v0.17.0 with go v1.16 => Not work

gqlgen v0.16.0 with go v1.16 => Work

gqlgen upgrade to v0.17.x will cause upload fail issue

i did't use apollo as my client. For gqlgen, after 0.17.0, it assume the client is using apollo client?