Network Error but everything seems ok #3429
-
I'm migrating from ApolloClient where everything is working. My query is authenticated and I've set things up so the bearer token is present in the request. The underlying fetch correctly does a CORS preflight check with a 204 response and the POST then sends the following payload: {"operationName":"members","query":"query members($members: [Int]!) {\n members(members: $members) {\n salutation\n firstname\n lastname\n member\n id\n GDPR\n smallboats\n status\n telephone\n mobile\n area\n town\n interests\n email\n primary\n profile\n __typename\n }\n}","variables":{"members":5004}} The server then returns the following 200 response (personal data removed): {"data": {"members": [{"salutation": "Mr", "firstname": "xxxx", "lastname": "xxxx", "member": 5004, "id": 559, "GDPR": true, "smallboats": true, "status": "Paid Up", "telephone": "", "mobile": "xxxxxxxxxx", "area": "Scotland", "town": "xxxx", "interests": ["DB", "NW"], "email": "xxxxxxxxx", "primary": true, "profile": "xxxxxxx", "__typename": "Member"}, {"salutation": "Mrs", "firstname": "xxx", "lastname": "xxx", "member": 5004, "id": 1219, "GDPR": true, "smallboats": true, "status": "Paid Up", "telephone": "", "mobile": "xxx xxx", "area": "Scotland", "town": "xxxx", "interests": ["EC"], "email": "xxxx", "primary": false, "profile": "", "__typename": "Member"}]}} So it looks like everything worked. What I expect: The useQuery returns no error and a data object. What I get: No data is returned but the error return contains: name: "CombinedError" Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hard to say at first glance, mind adding a console.log in the catch where makeErrorResult is called https://www.runpkg.com/?@urql/[email protected]/dist/urql-core-chunk.js or provide a reproduction |
Beta Was this translation helpful? Give feedback.
-
I'm struggling to get logging into the package. I can't really produce a reproduction as I have only live data and it contains personal information. I tried checking the project out and building it so I can refer to it locally but its not working for me. |
Beta Was this translation helpful? Give feedback.
-
Oh I think I know what's going on, do you happen to not use a Going from the result you see there it would be something with the content-type |
Beta Was this translation helpful? Give feedback.
Oh I think I know what's going on, do you happen to not use a
content-type
header in your response-headers? I seeHeaders(2)
in there which seems on the low side, according to the spec it is required to send back a content-type header https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#bodyGoing from the result you see there it would be something with the content-type
#3430