Uncaught Runtime Error After Successful React Project Build

I’ve successfully built my React project, but I’m encountering an Uncaught runtime error when running the application. The build process completes without errors, but upon starting the app, this runtime issue emerges.

Here are the details:

Uncaught TypeError: Cannot read properties of null (reading 'indexOf')
    at ut.fromString (index.esm2017.js:1032:1)
    at gh (index.esm2017.js:17952:1)
    at Layout.js:377:1
    at Array.forEach (<anonymous>)
    at Array.<anonymous> (Layout.js:373:1)
    at next (index.esm2017.js:20677:1)
    at index.esm2017.js:16739:1
useEffect(() => {
    if (localStorage.getItem("userdata")) {
        setUserRole(JSON.parse(localStorage.getItem("userdata")).role);
    }
    const unsubscribe = onSnapshot(collection(db, "supportRoom"), (snapshot) => {
        if (snapshot.docs.length == 0) {
            setHelpCall(false);
            setHelpCaller({});
        } else {
            const allData = snapshot.docs.map((doc) => ({
                id: doc.id,
                ...doc.data(),
            }));
            allData.forEach((docs) => {
                if (docs.response == false && docs.reciever == "") {
                    setSupportRoomData(supportRoomData);
                    setHelpCall(true);
                    const docRef = doc(db, "users", docs.creater);
                    getDoc(docRef).then((doc) => {
                        setHelpCaller(doc.data());
                        setHelpCallerId(doc.id);
                    });
                } else {
                    setHelpCall(false);
                }
            });
        }
    });
    return () => {
        // cancelHelpCall()
        unsubscribe();
    };
}, [userData]);

I have already tried to check data fetch from firebase, clearing the cache, resinstalling dependencies, but the issue persists.

Has anyone encountered a similar problem or have any suggestions for resolving this runtime error?

Thank you in advance for your help!