Skip to content
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

FileError in Samsung Internet Browser #475

Closed
marcoow opened this issue Feb 13, 2017 · 4 comments
Closed

FileError in Samsung Internet Browser #475

marcoow opened this issue Feb 13, 2017 · 4 comments

Comments

@marcoow
Copy link

marcoow commented Feb 13, 2017

Unfortunately this is a pretty vague bug report but at this point I don't really know how to debug it better 😞

We have an SPA that uses fetch (through https://github.com/stefanpenner/ember-fetch) and we're seeing a lot of FileErrors in production, all coming from Samsung Galaxies (6 and 7). The specific error is

The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.

which seems to be related to Chrome's FileReader implementation (see here and e.g. here). This is also the only indication I have for this being related to fetch at all since the only usage of the FileReader API in our app bundle is within this library. Unfortunately we're not seeing any stack traces for this error in Sentry and I currently don't have an actual device to test this on.

More specifically, all of these errors (we have about 13000 events for 3000 users) are on Android 6 with Samsung Browser5.0/Chrome 51.

@mislav
Copy link
Contributor

mislav commented Feb 14, 2017

Ouch; thanks for letting us know.

Unfortunately, it's not possible to avoid using FileReader within our polyfill right now. It's automatically used whenever you call the response.text() method. I'm guessing that is how you're using the polyfill?

The only workaround right now that I can suggest is to trick the broken browsers into thinking that they don't have support for FileReader while the polyfill is loading:

<script>
if (samsungGalax) {
  BrokenFileReader = FileReader
  window.FileReader = undefined
}
</script>
<script src="./fetch.js"></script>
<script>
if (samsungGalax) {
  window.FileReader = BrokenFileReader
  delete window.BrokenFileReader
}
</script>

After this, the polyfill will continue to assume that the FileReader interface is unavailable (even though you've restored it) and will not try to use it.

@marcoow
Copy link
Author

marcoow commented Feb 15, 2017

Unfortunately, it's not possible to avoid using FileReader within our polyfill right now. It's automatically used whenever you call the response.text() method. I'm guessing that is how you're using the polyfill?

Yes, we do use response.text().

The only workaround right now that I can suggest is to trick the broken browsers into thinking that they don't have support for FileReader while the polyfill is loading:

Hadn't even though of just forcing fetch to use the Polyfill… That should fix it of course - thanks for the hint!

BTW: your code is missing semicolons :trollface:

@wichert
Copy link

wichert commented May 9, 2018

@mislav I am hitting this as well. We happen to use response.json(), but I suspect that follows a very similar code path internally.

It is not just Samsung: the LG-D855 is hit by this as well. Affected Android versions include Android 4.1 though 6.0 based on the data I see in Sentry.

@nikcorg
Copy link

nikcorg commented Aug 13, 2018

@wichert yep. .json() invokes .text() internally.

I'm also seeing this bug manifesting itself on Chrome Mobile 38.0.1025 on Android 4.2 devices.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants