New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Received data was not a string, or was not a recognised encoding." #28

Open
adamrainsby opened this Issue Mar 9, 2016 · 17 comments

Comments

Projects
None yet
@adamrainsby
Copy link

adamrainsby commented Mar 9, 2016

It seems to be getting picked up by google analytics but I'm getting this warning. Any idea why?

I'm running ios version 9.2 and this is how I'm calling it.

    let screenView = new GAHits.ScreenView(
      config.app.name,
      screenName,
      config.app.version,
      config.app.id,
      null,
      null
    );
@miro

This comment has been minimized.

Copy link

miro commented Mar 17, 2016

Same here. But it seems that this appears only when running my application via the iOS simulator; when testing with iPhone, the warning doesn't pop up.

@CodeTitanian

This comment has been minimized.

Copy link

CodeTitanian commented Apr 11, 2016

+1

3 similar comments
@vkshrestha

This comment has been minimized.

Copy link

vkshrestha commented Apr 24, 2016

+1

@mofelee

This comment has been minimized.

Copy link

mofelee commented Apr 25, 2016

+1

@kevinhylant

This comment has been minimized.

Copy link

kevinhylant commented May 13, 2016

+1

@kevinhylant

This comment has been minimized.

Copy link

kevinhylant commented May 13, 2016

@lwansbrough Any update on this issue or is this something that is a bug with the RN core code?

@lwansbrough

This comment has been minimized.

Copy link
Collaborator

lwansbrough commented May 14, 2016

I think a recent version of React Native may have addressed the problem of receiving generic data from XHR requests. Is anyone still getting this warning with React Native 0.25?

@kevinhylant

This comment has been minimized.

Copy link

kevinhylant commented May 14, 2016

We're running RN at 0.23 right now, will try updating to see if it is resolved & let you know soon as I have - thanks!

@adeelraza

This comment has been minimized.

Copy link

adeelraza commented Jun 6, 2016

@lwansbrough still getting this warning on RN 26

@kevinhylant

This comment has been minimized.

Copy link

kevinhylant commented Jun 6, 2016

@adeelraza @lwansbrough - I can confirm the same.

@lwansbrough

This comment has been minimized.

Copy link
Collaborator

lwansbrough commented Jun 7, 2016

The other option is to use Image.prefetch instead of XHR but that's kind of an abuse of ram. Though 1x1 images are really small.

@Alons-Oh

This comment has been minimized.

Copy link

Alons-Oh commented Jun 7, 2016

Hi I'm getting this issue too, I don't know if this is preventing my GA to collect the data, or if the error just happens on my app and the GA should gather the info properly (which is not happening), I don't even know if this is the right place to ask for help on this XD I'm running RN 0.23, I'm trying on the iOS emulator and on my android device.
EDIT: Actually I found out GA is actually gathering the info properly, so the issue is only on the app.

@lwansbrough

This comment has been minimized.

Copy link
Collaborator

lwansbrough commented Jun 8, 2016

We're using this library in production in several apps without a problem. The only issue is the warning in dev mode. If anyone wants to try and sub the fetch call with Image.prefetch that would be helpful.

@xiaolv899

This comment has been minimized.

Copy link

xiaolv899 commented Jun 16, 2016

+1

1 similar comment
@oportocala

This comment has been minimized.

Copy link

oportocala commented Jun 20, 2016

+1

@lwansbrough

This comment has been minimized.

Copy link
Collaborator

lwansbrough commented Jun 20, 2016

Guys please stop +1ing this, GitHub has reactions now if you wish to indicate your interest/support. Beyond that, this issue is a problem with React Native itself. I'm tempted to close this as wontfix but I think there might be a better solution than that.

@peacechen

This comment has been minimized.

Copy link

peacechen commented May 31, 2018

Substituting Image.prefetch for fetch isn't ideal because that can flush out actual useful images from the image cache.

How about using the underlying XMLHttpRequest?

In Analytics.js, replace fetch with:

return new Promise(function (resolve, reject) {
      let xhr = new XMLHttpRequest();
      xhr.open('GET', request);
      xhr.setRequestHeader('User-Agent', this.userAgent);
      xhr.onload = resolve;
      xhr.onerror = reject;
      xhr.send();
});

Scratch that. Still getting the yellow box warnings with XMLHttpRequest. Looks like this needs to be fixed in RN itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment