Skip to content

getDocs never resolves or rejects #7787

@abelHodasz

Description

@abelHodasz

Operating System

Ubuntu 20.04.6 LTS

Browser Version

Chrome Version 119.0.6045.105

Firebase SDK Version

10.6.0

Firebase SDK Product:

Firestore

Describe your project's tooling

I'm using vite with typescript and react and react-router.

Describe the problem

I'm trying to run multiple queries after each other. But about 10% of the time, it hangs on one of the queries and getDocs doesn't resolve and doesn't throw error. It just stops the main thread.

It is an issue both with emulator and in production code.

Here are the relevant logs:
logs.json

Steps and code to reproduce issue

    const menuItemsQuery = query(collection(firestore, "menuItems"), where("restaurantId", "==", restaurantId)).withConverter(menuItemConverter);
    const categoriesQuery = query(collection(firestore, "categories"), where("restaurantId", "==", restaurantId)).withConverter(categoryConverter);
    const menuQuery = query(collection(firestore, "menus"), where("restaurantId", "==", restaurantId)).withConverter(menuConverter);
    const extrasQuery = query(collection(firestore, "extras"), where("restaurantId", "==", restaurantId)).withConverter(extraConverter);
    try {
        const timeout = window.setTimeout(() => {
            console.log("________________________________FETCH FAILED________________________________")
        }, 10000)

        const menuItemsSnapshot = await getDocs(menuItemsQuery);
        console.log("got menuItems")
        const categoriesSnapshot = await getDocs(categoriesQuery);
        console.log("got categories")
        const menuSnapshot = await getDocs(menuQuery);
        console.log("got menu")
        const extraSnapshot = await getDocs(extrasQuery);
        console.log("got extras")
        window.clearTimeout(timeout)
    } catch(err) {
        console.log(err)
    }

Metadata

Metadata

Assignees

Labels

api: firestorenewA new issue that hasn't be categoirzed as question, bug or feature requestquestion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions