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

🐛 [cloud_firestore_web]: Uncaught (in promise) unimplemented when using loadBundle #9140

Closed
rohansohonee opened this issue Jul 18, 2022 · 10 comments
Assignees
Labels
blocked: firebase-sdk platform: web Issues / PRs which are specifically for web. plugin: cloud_firestore resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@rohansohonee
Copy link

Bug report

When using the loadBundle on web, the browser dev tool's console window displays the following error message:

Uncaught (in promise) unimplemented
  | loadBundle | @ | firestore.dart:114
  | loadBundle | @ | cloud_firestore_web.dart:171
  | loadBundle | @ | firestore.dart:98

Expected behavior

Should not throw any errors.

Additional Context

There are no errors shown in IDE(Android Studio) console. The errors are only being shown in the browsers console log.

Flutter doctor

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.69.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Flutter dependencies

dependencies:
 cloud_firestore: 3.2.1
 firebase_core: 1.19.1

dependency_overrides:
  firebase_core_web: 1.6.6
  cloud_firestore_web: 2.6.19

Only depending on firebase dependencies to produce this issue.
Added certain overrides because of firebase_core_web issue with version 1.7.0 as mentioned here: #9132

@rohansohonee rohansohonee added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jul 18, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label Jul 19, 2022
@darshankawar
Copy link

@rohansohonee This looks similar to #7722.
In your case, does it occur locally or when you deploy to server ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jul 19, 2022
@rohansohonee
Copy link
Author

@darshankawar it occurs both locally and on deployed server.

In my error I do not have the "invalid argument" being shown as described in the issue you referenced.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jul 19, 2022
@darshankawar
Copy link

Thanks for the update. Can you provide minimal reproducible code sample that triggers this error ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jul 20, 2022
@rohansohonee
Copy link
Author

@darshankawar it is producible with the example https://firebase.flutter.dev/docs/firestore/usage/#data-bundles

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jul 20, 2022
@darshankawar
Copy link

Looking at the example, the data bundle is being converted from string to Uint8List instance:

// Convert the 'bundle.txt' string in the response to an Uint8List instance.
Uint8List buffer = Uint8List.fromList(response.body.codeUnits);

Can you provide response.body in properly formatted text ?

I am guessing the error could be due to the way web js sdk is handling the conversion. I see a similar issue in their repo: firebase/firebase-js-sdk#5838

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jul 21, 2022
@rohansohonee
Copy link
Author

@darshankawar It can be produced from the sample I provided in #9114

So you can inspect the response.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jul 21, 2022
@darshankawar
Copy link

Thanks. Using the code sample provided in linked issue, I am able to replicate the error mentioned.

A similar issue was raised upstream : firebase/firebase-js-sdk#5838

Also related : #7722

@darshankawar darshankawar added plugin: cloud_firestore platform: web Issues / PRs which are specifically for web. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Jul 22, 2022
@rohansohonee
Copy link
Author

Also faced this issue after upgrading to JS v9

firebase_core: 1.20.0
cloud_firestore: 3.4.1

@russellwheatley russellwheatley self-assigned this Jul 28, 2022
@russellwheatley
Copy link
Member

russellwheatley commented Jul 28, 2022

I've just tested this, and the exception does occur. However, it still bundles the data.

I've also tested this using a purely JS implementation like so:

import { initializeApp } from 'firebase/app';
import { getFirestore, loadBundle } from 'firebase/firestore';

const firebaseConfig = {
  apiKey: "AIzaSyAgUhHU8wSJgO5MVNy95tMT07NEjzMOfz0",
  authDomain: "react-native-firebase-testing.firebaseapp.com",
  databaseURL: "https://react-native-firebase-testing.firebaseio.com",
  projectId: "react-native-firebase-testing",
  storageBucket: "react-native-firebase-testing.appspot.com",
  messagingSenderId: "448618578101",
  appId: "1:448618578101:web:f9978594cf6fc210ac3efc",
  measurementId: "G-9DTMXSP12B"
}

var app = initializeApp(firebaseConfig);

var firestore = getFirestore(app);

async function loadBundleFunc(){
  // bundle I've created and hosted on a local node server:
  var response = await fetch('http://localhost:3000/bundle');

  var data = await response.arrayBuffer();
  var loadBundleTask = await loadBundle(firestore, data);
  console.log('loadBundleTask', loadBundleTask); // loadBundleTask {taskState: 'Success', documentsLoaded: 3, bytesLoaded: 1465, totalDocuments: 3, totalBytes: '1465'}
}

loadBundleFunc();

and I still got that exception in my browser:

Screenshot 2022-07-28 at 14 17 00

I believe this error is coming from the firebase-js-sdk, and I would encourage you to create an issue on their repository here.

@russellwheatley
Copy link
Member

This issue has now been fixed upstream in the native Firebase web JS SDK. See here: firebase/firebase-js-sdk#5838

@darshankawar darshankawar added the resolution: fixed A fix has been merged or is pending merge from a PR. label Jan 2, 2024
@firebase firebase locked and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: firebase-sdk platform: web Issues / PRs which are specifically for web. plugin: cloud_firestore resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants