I'm encountering a persistent WebChannel Transport Error (400 Bad Request) when trying to write to Firestore. This occurs specifically when making requests to the Write channel (firestore.googleapis/google.firestore.v1.Firestore/Write/channel).
Specific behavior:
- Multiple channel/gsessionid requests are failing consecutively
- WebChannel-related requests are repeatedly failing
- This happens consistently when trying to save data to Firestore
- The error occurs in a production environment with proper Firebase configuration
Request details:
- URL: firestore.googleapis/google.firestore.v1.Firestore/Write/channel
- Method: GET
- Status: 400 Bad Request
- Origin: http://localhost:3000
Despite having valid Firebase configuration and authentication, these requests consistently fail with a 400 Bad Request error.
Expected behavior:
- Successfully save data to Firestore database
- Normal WebChannel connection establishment
- No transport errors during write operations
What I tried:
- Verified Firebase configuration and initialization
- Checked all security rules in Firebase Console
- Confirmed that the authentication token is properly set in Chrome
- Tested in both environments:
- Local development (localhost:3000)
- Production (deployed environment)
The application consistently fails with a 400 Bad Request error in Chrome (Version 131.0.0.0) on both local and deployed environments. Even with proper Firebase setup and authentication, the write operations are failing with WebChannel transport errors.
type here
// Firebase initialization
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
// Write operation where the error occurs
try {
await addDoc(collection(db, 'community'), {
title: data.title,
content: data.content,
authorId: currentUser.uid,
// ... other fields
});
} catch (error) {
console.error('Error writing document:', error);
}