Skip to content

Firestore AggregateQuery is now broken when using the Firestore emulator with firebase-tools version 13.3.1 specifically on firebase-js-sdk #6808

Closed

Description

@russellwheatley

[REQUIRED] Environment info

13.3.1

firebase-tools:

Sonoma 14.0

Platform:

[REQUIRED] Test case

import { initializeApp } from 'firebase/app';
import {
  getFirestore,
  collection,
  getCountFromServer,
  connectFirestoreEmulator,
} from 'firebase/firestore';

var config = {
// USE YOUR OWN FIREBASE CONFIG
};

initializeApp(config);

const db = getFirestore();
connectFirestoreEmulator(db, 'localhost', 8080);

// UPDATE COLLECTION TO ONE OF YOUR CHOICE THAT HAS READ ACCESS
const collectionRef = 'flutter-tests';


async function callCount() {
  const coll = collection(db, collectionRef);
  const snapshot = await getCountFromServer(coll);
  console.log('count: ', snapshot.data().count);  
}

document.getElementById('button-id').addEventListener('click', () => {
  callCount();
});

[REQUIRED] Steps to reproduce

  1. Insert the above script into a HTML file with necessary Firebase web setup.
  2. Insert your own Firebase config from the Firebase console.
  3. Update collection to one that has read access.
  4. Fire up Firestore emulator using latest firebase-tools.
  5. See an "internal" exception appear in the browser console.

[REQUIRED] Expected behavior

If you want to see the expected behaviour, you can roll back firebase-tools to the previous version 13.3.0 which successfully resolves the aggregate query count().

[REQUIRED] Actual behavior

"internal" exception appears in the browser console. It is worth noting, it doesn't appear to be an issue for firebase-android-sdk or firebase-ios-sdk. It just occurs on firebase-js-sdk. Here are the failing web firestore integration tests as a result of this bug: https://github.com/firebase/flutterfire/actions/runs/8006650817/job/21897706676?pr=12369#step:11:247

Activity

  1. changed the title [-]Firestore AggregateQuery is now broken when using the Firestore emulator[/-] [+]Firestore AggregateQuery is now broken when using the Firestore emulator with firebase-tools version `13.3.1`[/+] on Feb 23, 2024
  2. changed the title [-]Firestore AggregateQuery is now broken when using the Firestore emulator with firebase-tools version `13.3.1`[/-] [+]Firestore AggregateQuery is now broken when using the Firestore emulator with firebase-tools version `13.3.1` specifically on firebase-js-sdk[/+] on Feb 23, 2024
  3. aalej commented on Feb 23, 2024

    @aalej
    Contributor

    Hey @russellwheatley, thanks for raising this and for filing a detailed report. I was able to reproduce the issue mentioned. Let me raise this to our engineering team so that they can take a look and investigate the issue.

  4. aalej commented on Feb 23, 2024

    @aalej
    Contributor

    Just a quick update here, our team is currently investigating the cause of this issue. For now, I can only recommend downgrading to firebase-tools v13.3.0 as a workaround. Apologies for the inconvenience this may have caused.

  5. self-assigned this
    on Feb 27, 2024
  6. harshyyy21 commented on Mar 11, 2024

    @harshyyy21
    Contributor

    Hi @russellwheatley, this should be fixed in the next release this week. Sorry for any inconveniences!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions