-
Notifications
You must be signed in to change notification settings - Fork 930
Firestore Bundling: db.loadBundle fails with error "[ReferenceError: Can't find variable: ReadableStream]" #5863
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
Comments
Hi @ankitmaloo. Could you enable Firestore https://firebase.google.com/docs/reference/js/v8/firebase.firestore#setloglevel |
Hi resp.status is 200. Attaching the logs as well. I can somehow DM you the url as well if that helps. |
Sure, you can DM me at my GitHub username @google.com. Or, you can just attach the response body here in the ticket, if its contents are suitable for being world-readable. |
Also, I'm not personally familiar with Expo React Native; could you verify that ReadableStream is indeed available at all? Could you also try using |
Hi Denver Sent you the url and the exact code on the email you mentioned. Edit: With arrayBuffer, I get this Error: FileReader.readAsArrayBuffer is not implemented (probably not a firebase bug) |
I've received your email. Thank you for the information. Looking at your bundle, I see that it contains some Unicode characters that require multiple bytes when encoded via UTF-8, such as é and ✨. I wonder if this is a symptom of a bug in Firestore where it doesn't handle multibyte UTF-8 encodings of characters correctly. While I investigate this, are you by chance able to try reproducing with a bundle that contains only ASCII characters? If not, that's fine too. |
Tried it. Same error. No special characters. Just arrays that you see. (you can also see the new binary on the same link I sent you) |
Hmm, okay so it looks like the multibyte UTF-8 character hypothesis was incorrect. Thanks for checking. I can't reproduce this error using the Web SDK directly, so that means it may be something to do with Expo React Native. Could you first try upgrading to the latest version of the SDK, 8.10.0? If you're not too far along in your app's development, also consider switching to the modular v9 Firebase SDK because the v8 SDK is now just in maintenance mode. Since I do not have experience with Expo React Native, would you be able to create a minimal app that reproduces the issue, such as in a GitHub repository that I can clone? |
Let me check with 8.10.0. v9 modular could be difficult as there would be a lot of breaking changes. Will share a repo for a minimal app with you in a day or so. |
I debugged a bit further, this is what my response looks like:
Any ideas? This looks different to what it shows up on web fetch. |
Hi I used this link: https://stackoverflow.com/questions/55868484/referenceerror-cant-find-variable-textencoder as a reference, and this seems to work. Would still monitor this to see if it is indeed working as expected before moving it to production |
@ankitmaloo It does indeed look like a polyfill is a feasible workaround. There is another customer report of a similar issue: #5838. Could you try the workaround documented there? |
Hi, That is the same workaround. JS Core does not have text encoders. I have to response.text() to get the response in right format, and then use encoder to encode it to Uint8Array. This worked. Would test thoroughly before moving to production. |
Thanks for confirming. I'm going to close this issue as a duplicate of #5838 but feel free to re-open if you disagree. |
Describe your environment
Describe the problem:
I am using Bundling as described by the solution in the documentation here: https://firebase.google.com/docs/firestore/solutions/serve-bundles
It works well till hosting, the file is hosted on the web, and I can fetch it using fetch, but fails at this part of the code.
await db.loadBundle(resp.body);
Steps to Reproduce:
Relevant Code:
The text was updated successfully, but these errors were encountered: