Skip to content
Advertisement

Uncaught Error in snapshot listener: FirebaseError: no matching index found

I’m getting the above error when running the following query. I’ve not seen it before, can’t find any documentation about it, and I’m not doing anything unusual or anything I’ve not done before. Can anyone shed any light on it, please?

const getUserProjects = async () => {
    return await useFireStore
    .collection('projects')
    .where('paid','==',true)
    .where('ownerId','==', `${currentUser.uid}`)
    .orderBy('createdAt', 'desc')
    .onSnapshot(snapshot => {
        let projects = [];
        snapshot.forEach(doc => {
            projects.push({...doc.data(), id: doc.id })
        });
        setUserProjects(projects);
    });
};

It is a ‘new’ query in that I’ve just added it to the code, so I might expect the error in the console that gives a link for a new composite index to be created or whatever it’s called, but I’m just getting this instead:

Firestore Console Error

EDIT: I have tried manually creating an Index, but I still get the same error. I have also got a query on the same page which is exactly the same apart from the collection name, and that works fine.

Advertisement

Answer

This is an internal bug in the SDK.

Firebase team is working on it, follow the issue here.

Advertisement