Howtographql: this.props.relay.environment._network.fetch is not a function

Created on 11 Sep 2017  路  6Comments  路  Source: howtographql/howtographql

Unhandled Rejection (TypeError): _this.props.relay.environment._network.fetch is not a function
Link._callee2$

Most helpful comment

My sincere apologies for the delay in responding to this issue! This has been fixed in the actual react-relay repo by simply using the fetchQuery function, see here.

Unfortunately I don't have time atm to update the tutorial, but happy to take a PR from anyone who would like to contribute 馃檪 (note that you also adjust the way how the Environment.js file looks in the Getting Started chapter.

All 6 comments

Any updates on this?
It might help to downgrade packages react-relay, relay-compiler and babel-relay-plugin to version 1.1.0 instead of currently latest version 1.3.0. This solved for me the problem with presence of fetch in the _network object, but another different problem with updater function appeared.

Sure enough... downgrading to [email protected] [yarn add [email protected]] solved the problem for me.

It appears [email protected] has left out a few _this.props.relay.environment._network functions. After putting a breakpoint in Chrome before the network fetch line, using [email protected] this shows:

screen shot 2017-09-20 at 2 20 34 am

and using [email protected] this shows:

screen shot 2017-09-20 at 2 30 42 am

It appears that the functions fetch, request, and requestStream have disappeared in 1.3.0?

Is this by design or error?

#https://github.com/facebook/relay/issues/2110#issuecomment-330721856

this is not a public api, you should avoid using like this

https://github.com/facebook/relay/issues/2110#issuecomment-330722289

_ prefix is a convention we use for private properties. I'm not sure what the use case is here, but you should probably use a QueryRenderer or refetch container here.
We've made some changes to the network layer recently to allow more complex network response formats like potential streaming. The Network module is pretty much internal API.

any updates? I assume that refetch container may be a good option?

My sincere apologies for the delay in responding to this issue! This has been fixed in the actual react-relay repo by simply using the fetchQuery function, see here.

Unfortunately I don't have time atm to update the tutorial, but happy to take a PR from anyone who would like to contribute 馃檪 (note that you also adjust the way how the Environment.js file looks in the Getting Started chapter.

Thanks @burnick for opening this issue 馃槃. Closing this due to inactivity!

Was this page helpful?
0 / 5 - 0 ratings