skip to Main Content

I’m trying to store data at firestore collection but getting this error again and again unable to store data on my messages collection.
@firebase/firestore: Firestore (10.12.3): WebChannelConnection RPC 'Write' stream 0x401c795e transport errored

await addDoc(collection(db, "messages"), {
        text: value,
        name: username,
        createdAt: serverTimestamp(),
        uid
      })

I want to store messages data to firestore

2

Answers


  1. Probably similar question to Firestore (9.6.6): Connection WebChannel transport errored:

    According to @Kingsley

    Initialize your firestore by doing:

    const app = initializeApp(firebaseConfig);
    export const db = initializeFirestore(app, {
      experimentalForceLongPolling: true,
      useFetchStreams: false,
    });
    
    Login or Signup to reply.
  2. This was already answered on Github

    But for everyone new struggling with this Error, try this:

    export const db = initializeFirestore(app, {
      experimentalForceLongPolling: true
    })
    

    instead of this:

    export const db = getFirestore(app);
    

    Seems like some routers get a HTTP 418: I’m a teapot response.
    Also always check https://debug-my.firebaseapp.com.

    If anyone still struggles, I am open for help.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search