99designs / gqlgen

go generate based graphql server library
https://gqlgen.com
MIT License
9.96k stars 1.17k forks source link

Latest release breaks Apollo. #2817

Open ShawnMilo opened 1 year ago

ShawnMilo commented 1 year ago

What happened?

I upgraded from v0.17.27 to v0.17.38.

Apollo stopped working. All attempts return the error Could not parse MIME type string application/json, application/json, which implies that the header is now being sent twice.

The GraphiQL Playground continues to work as normal.

What did you expect?

Apollo to work as usual.

Minimal graphql.schema and models to reproduce

N/A -- broken at the HTTP level.

versions

> go run github.com/99designs/gqlgen version
v0.17.38
> go version
go version go1.21.0 linux/amd64
UnAfraid commented 1 year ago

Apollo client works for me, there are also integration tests that are covering apollo client and urql, can you give a bit more info on how to reproduce?

ShawnMilo commented 1 year ago

Any chance you're using Firefox, @UnAfraid?

I was just informed it works in Firefox. I tested, and it's so. I tried hitting a very simple query (no arguments/parameters) and it works in GraphiQL in both browsers, but in Chrome I get the error described above, and in Firefox it works.

Error from Apollo in Chrome:


{
  "data": {},
  "error": {
    "message": "Could not parse MIME type string \"application/json, application/json\"",
    "stack": "Error: Could not parse MIME type string \"application/json, application/json\"\n    at new a (https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:12690)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:11975\n    at Generator.next (<anonymous>)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:774\n    at new Promise (<anonymous>)\n    at s (https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:519)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:11812"
  }
}```
UnAfraid commented 1 year ago

Any chance you're using Firefox, @UnAfraid?

I was just informed it works in Firefox. I tested, and it's so. I tried hitting a very simple query (no arguments/parameters) and it works in GraphiQL in both browsers, but in Chrome I get the error described above, and in Firefox it works.

Error from Apollo in Chrome:

{
  "data": {},
  "error": {
    "message": "Could not parse MIME type string \"application/json, application/json\"",
    "stack": "Error: Could not parse MIME type string \"application/json, application/json\"\n    at new a (https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:12690)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:11975\n    at Generator.next (<anonymous>)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:774\n    at new Promise (<anonymous>)\n    at s (https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:519)\n    at https://embeddable-sandbox.cdn.apollographql.com/7212121cad97028b007e974956dc951ce89d683c/embeddable-sandbox.umd.production.min.js:1:11812"
  }
}```

No, i am not using Firefox, Chrome/Edge and Safari mostly, but at work we run gqlgen on the backend and react with apollo client on the frontend.
And i don't think i saw such error in our error reporting.

Can you share a bit more on how you are using apollo client?

Edit: I just notice you are talking about the Apollo Embeddable Sandbox, i also just tested it, and works perfectly fine for me as well.