Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!