Relay: [modern] 1.3 normalize mutation payload error

Created on 29 Aug 2017  路  9Comments  路  Source: facebook/relay

normalizePayload function throws error if there is no data returned from mutation,
which is pretty normal, when mutation could not be completed.
Is it new design or mistake?

Uncaught Error: No data returned for operation `addToWishListMutation`, got error(s):
viewer.not-authorized

Most helpful comment

@ViktorAksionov I'd appreciate if you add a thumb here, if you haven't already, so we can highlight that this issue is ongoing, and important!

https://github.com/facebook/relay/issues/2385

All 9 comments

It seems you have to provide onError handler to suppress error throwing.

cc @leebyron

@kassens @leebyron Is this intended behaviour? I'm encountering this in the wild (with a QueryRenderer) in 1.5.0.

The GraphQL spec definitely defines that the data key should be missing or null, in cases where errors are encountered. (http://facebook.github.io/graphql/October2016/#sec-Data) And it's currently not obvious to me how I should handle the case that Relay balks.

I wonder if this was introduced here?

https://github.com/facebook/relay/commit/f76f12a56b2ed7486b8d4a0ce5d8efdf206c2b9a#diff-da1024b9cd4061ec3cd490cf469b8500

It looks like this is a new issue. I'll follow up here:

https://github.com/facebook/relay/issues/2385

cc @dwwoelfel

After upgrade from 1.4 to 1.5 I see such error too.
Why such breaking changes introduced in minor update?? What is a fix for that?

I do have onError and onCompleted handlers, but relay ignores onError and passed to onCompleted(undefined, [{...}]) and throws an exception

No data returned for operation `someMutation`, got error(s): ...

after that from ExceptionsManager (react-native/Libraries/Core/ExceptionsManager.js)

@ViktorAksionov I'd appreciate if you add a thumb here, if you haven't already, so we can highlight that this issue is ongoing, and important!

https://github.com/facebook/relay/issues/2385

Any solution?

Uncaught RelayNetwork: No data returned for operation

@MM3y3r please open an issue issue with your use case

Was this page helpful?
0 / 5 - 0 ratings