I am trying to create a document 'users' on my Firestore. Firebase performs its job fantastically, however when creating a new user, Firestore does not properly execute the function and in response it floods the network with 200 status.
In order to try to resolve this issue I deleted the whole firebase project, made a new one from scratch, but nothing was resolved.
On my side it all seems perfectly ok, I followed Google Firestore documentation by the letter. is any of you able to give me an understanding of the issue. Just to be clear in the console no error is displayed.
Here is SignUp.jsx
const handleSubmit = async (e) => {
e.preventDefault();
if (password !== passwordConfirm) {
return setError('Passwords do not match');
}
try {
setError('');
setLoading(true);
const user = await register(email, password);
const uid = user.uid;
console.log(uid);
await addUser(user.email);
console.log('If I see this all went processed');
navigate('/tutorials');
} catch (error) {
console.log(error);
setError('Failed to create an account');
setError(error.message);
}
setLoading(false);
};
Then when addUser(user.email) is invoked, the program goes here
try {
const docRef = await addDoc(collection(db, 'users'), {
email,
htmlCode: '',
cssCode: '',
jsCode: '',
});
console.log('Document written with ID: ', docRef.id);
} catch (e) {
console.error('Error adding document: ', e);
}
};
Then I see no error on console, but a bunch of this 200 status
[
If anyone would like to look at more detailed info I could always provide them. Thank you very much for your help in advance!
Sorry for texting that as an answer, cannot add a comments yet. I've found a close to your's issue in the firebase github repo.
Here it is: https://github.com/firebase/firebase-js-sdk/issues/5852
Shortly:
firebase.firestore.setLogLevel('debug');
Recheck your firebase/firestore configuration
Try to change firebase libs versions, it does matters sometimes, had a bunch of broken libs and a lot of headache with them
Your code looks completely valid to me.