Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
getting an error while trying to run my app with firestore: Attempted to assign to readonly property

I'm currently working on an app in which you can keep track of Root Canal patients and it was working fine for a long time...but after the new update of the firebase package in expo...I've been getting an error while trying to sign up. It says "Attempted to assign to readonly property" but my cloud firestore rules are set so that it is allowed. So, I am not too sure about what I did wrong.

This is the firestore rules:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if
          request.time < timestamp.date(2023, 12, 31);
    }
  }
}

This is the code for the sign up function:

onSignUp = async (email, password) => {
    firebase // used import * as firebase from 'firebase/auth'
      .createUserWithEmailAndPassword(
        this.state.modalEmail,
        this.state.modalPassword
      )
      .then(() => {
        firestore // used import * as firestore from 'firebase/firestore'
          .collection("Users")
          .doc(this.state.modalEmail)
          .set({
            username: this.state.username,
            email_id: this.state.modalEmail,
            clinicName: this.state.clinicName,
            age: this.state.age,
            phoneNumber: this.state.phoneNumber,
            tablets: []
          });
        this.setState({ isModalVisible: false });
        this.props.navigation.replace("Home");
      })
      .catch((error) => {
        Alert.alert("Coudn't create user", error.message);
        console.log(error)
      });
  };

the error I'm getting:

enter image description here

If you have any idea on what I did wrong or what I could do to fix this issue please let me know. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If your using firebase 9, the signature is changed. the auth object needs to be passed as first parameter.

const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)

https://firebase.google.com/docs/auth/web/password-auth

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda