react-native: [RCTNetworking] Received data was invalid.

Hi,

since v0.7.0-rc.2, I get the following error:

  [error][tid:com.facebook.React.RCTNetworkingQueue][RCTNetworking.m:384] Received data was invalid.

When trying to fetch() something as follows:

    fetch('https://ssl.google-analytics.com/collect', {
      method: 'post',
      body: hit.toQueryString()
    });

This code was working in prior versions of RN. The return from google seems to be an empty gif (1x1px).

P.S. this is from react-native-google-analytics.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 40 (32 by maintainers)

Commits related to this issue

Most upvoted comments

@nicklockwood The reason why this is affecting me is actually out of my control. I’m sending Google Analytics data to Google’s collect URL, and they send back a 1x1 image. Is there anyway we can “dangerously allow” binary content?

@PaulMest if you want to retrieve images via a network request, you’ll have to do this via the Image.prefetch() API, or do it with native code. Retrieving image data on the JS side is not supported in RN (it would be a bad idea since you’d have to base64-encode the data to send it to the native side for display, so it’s better just to keep the image on the native side to begin with).

@chirag04 can you reopen this? It appears people are still having an issue with this. https://github.com/lwansbrough/react-native-google-analytics/issues/19#issuecomment-162602098