urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.65k stars 454 forks source link

"Files" in the operations object is not null in version 4.X #3168

Closed oneinchman closed 1 year ago

oneinchman commented 1 year ago

Describe the bug

First of all, thank you for a real nice piece of software. More versatile than other GraphQL tools I have tried in the past. But now to my problem at hand.

Since upgrading to the latest version of @urql/core, i removed @urql/exchange-multipart-fetch as a dependency but now my file uploads fails.
Instead of null, files are now objects with a __key field inside the JSON operations object, e.g. {"__key":"q6w2iwja1ta"}.

My API supports the unofficial GraphQL multipart request specification, where files inside the operation object should be null. This causes the API to throw an internal server error.

Is this intentional? If so, what is the recommended approach for the API to support this? Or can I somehow force urql to set the files to null?

A reproducible example can be found using the with-multipart example in your repo.

Im running Google Chrome 112.0.5615.137 on Mac OS Ventura 13.3.1

Reproduction

https://github.com/urql-graphql/urql/tree/main/examples/with-multipart

Urql version

urql v4.0.4

Validations