Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDoc() is never resolved nor rejected #7911

Closed
AnthonyLzq opened this issue Dec 26, 2023 · 10 comments
Closed

getDoc() is never resolved nor rejected #7911

AnthonyLzq opened this issue Dec 26, 2023 · 10 comments

Comments

@AnthonyLzq
Copy link

AnthonyLzq commented Dec 26, 2023

Operating System

macOS 14.1.2 23B92 arm64

Browser Version

Brave on macOS (Chrome 120 on macOS (Sonoma))

Firebase SDK Version

10.7.1

Firebase SDK Product:

Firestore

Describe your project's tooling

Remix

Describe the problem

For some reason, getDoc function does not work when I use fireabse/firestore/lite, but without lite, it does.

Steps and code to reproduce issue

When I try to do the following:

import { initializeApp } from 'firebase/app'
import { getFirestore, doc, getDoc } from 'firebase/firestore/lite'

const firebaseConfig = { /* some attributes here */ }
const firebaseApp = initializeApp(firebaseConfig)
const db = getFirestore(firebaseApp)
const clientRef = doc(db, 'users', id)
const clientSnap = await getDoc(clientRef)

// the above part never resolves

But if I change the code to use:

import { getFirestore, doc, getDoc } from 'firebase/firestore'

Instead of:

import { getFirestore, doc, getDoc } from 'firebase/firestore/lite'

It works fine

@AnthonyLzq AnthonyLzq added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Dec 26, 2023
@paulinon paulinon removed the new A new issue that hasn't be categoirzed as question, bug or feature request label Dec 26, 2023
@MarkDuckworth MarkDuckworth self-assigned this Dec 26, 2023
@MarkDuckworth
Copy link
Contributor

@AnthonyLzq, I'm unable to reproduce this with Firebase v10.7.1 on Brave browser or Chrome. Can you enable debug logging for the Firestore package and send us the logs?

Add this line during the setup to write Firestore SDK logs.

setLogLevel('debug');

@google-oss-bot
Copy link
Contributor

Hey @AnthonyLzq. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@AnthonyLzq
Copy link
Author

I'm sorry I couldn't provide more context. I'll try to give you a minimal example today.

@luizfelmach
Copy link

Same issue here with addDoc. Im using 10.7.1 too.

@MarkDuckworth
Copy link
Contributor

@luizfelmach, can you provide logs from the Firestore SDK that capture when the issue occurs for you?

setLogLevel('debug');

@luizfelmach
Copy link

@luizfelmach, can you provide logs from the Firestore SDK that capture when the issue occurs for you?

setLogLevel('debug');

I discovered that the environment variables were not working in Next.js even with NEXT_PUBLIC. So the problem wasn't in firebase. However, it would be interesting if firebase returned an error if it was unable to connect. I believe that a maxtimeout and return an error so that you don't spend hours trying to find the error.

@MarkDuckworth
Copy link
Contributor

@luizfelmach, thanks for the follow up. That sounds like expected behavior for addDoc() when offline. If the write cannot be sent to the backend because the SDK cannot connect, then the write will be cached in the SDK and sent when the SDK can connect again. This is part of offering a seamless online and offline support in the SDK. Unfortunately, it sounds like this was a source of confusion for you today.

@luizfelmach
Copy link

@luizfelmach, thanks for the follow up. That sounds like expected behavior for addDoc() when offline. If the write cannot be sent to the backend because the SDK cannot connect, then the write will be cached in the SDK and sent when the SDK can connect again. This is part of offering a seamless online and offline support in the SDK. Unfortunately, it sounds like this was a source of confusion for you today.

Okay. Sorry about that and thanks for the help.

@google-oss-bot
Copy link
Contributor

Hey @AnthonyLzq. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@AnthonyLzq if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants