title: unexplained firebase real time database timeout getting data from client
body: <p>I'm having a weird issue where some of my users are getting timeouts when requesting their account information from the firebase realtime database (super small objects).</p>
  <p><strong>Call to get user data</strong></p>
  <pre class="lang-js prettyprint-override"><code>export const getUserData = (userId) =&gt;
    new Promise((resolve, reject) =&gt; {
      onValue(
        ref(db, '/users/' + userId),
        (snapshot) =&gt; resolve(snapshot.val()),
        (err) =&gt; {
          console.error('err', err)
          reject(err)
        },
        { onlyOnce: true }
      )
    })
  </code></pre>
  <p><strong>User login hook:</strong></p>
  <pre><code>useEffect(() =&gt; {
      // onAuthStateChanged returns an unsubscribe method
      const unsubscribe = onAuthStateChanged(auth, (user) =&gt; {
        setCurrentUser(user)
        if (user) {
          const getUserDataTimeout = setTimeout(() =&gt; {
            // FAILS HERE FOR SOME USERS
            setLoading(false)
            setUserDataError(
              'User data request timeout, try refreshing the page or another browser, and please contact us at support@example.com.'
            )
             // 5s is irrelevant, after 1s it'll never complete
          }, 5000)
          getUserData(user.uid)
            .then((userData) =&gt; {
              setLoading(false)
              setUserData(userData)
              clearTimeout(getUserDataTimeout)
            })
            .catch((err) =&gt; {
              console.error(&quot;couldn't get user data&quot;, err)
              setLoading(false)
              setUserDataError(err.message)
              clearTimeout(getUserDataTimeout)
            })
        } else {
          setLoading(false)
        }
      })
      return unsubscribe
    }, [])
  </code></pre>
  <p>When logging into that user's account, I have no issues. Their issue seems to go away when switching from latest Chrome to a different browser. I feel like it has something to do with web sockets being blocked by the network. I tried throttling the connection and it's still lightning fast. <strong>Any advice on how to debug, or what could be causing it?</strong></p>