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

206
Views
Uncaught (in promise) FirebaseError: Expected type 'wc', but it was: a custom Vc object

The indicated error appears on line //line29, and I am not able to find the error within the code, can someone help me? the code is to show the information of the registered users when it is searched through the cpf;

   const app = initializeApp(firebaseConfig);
   const db = getFirestore(app);

async function GetADocument(){
var Ref =  setDoc(db, 'cpf', pesquisa.value);
const docSnap  = await getDocs(Ref);

  if(docSnap.exists(cpf = pesquisa)){
    nome.value = docSnap.data().nome;
    endereco.value = docSnap.data().endereco;
    bairro.value = docSnap.data().bairro;
    cidade.value = docSnap.data().cidade;
    uf.value = docSnap.data().uf;
    cep.value = docSnap.data().cep;
    rg.value = docSnap.data().rg;
    cpf.value = docSnap.data().cpf;
    nascimento.value = docSnap.data().nascimento;
    tel.value = docSnap.data().tel;
    cel.value = docSnap.data().cel;
    titulo.value = docSnap.data().titulo;
    zona.value = docSnap.data().zona;
    secao.value = docSnap.data().secao;
    pai.value = docSnap.data().pai;
    mae.value = docSnap.data().mae;
  }
   else{
    alert("usuário não encontrado");
   }
} //line29

btnbuscar.addEventListener("click", GetADocument);


about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

setDoc is used to write a document. If you want to create a DocumentReference you need to use doc.

Try changing

var Ref =  setDoc(db, 'cpf', pesquisa.value);

to

var Ref = doc(db, 'cpf', pesquisa.value);

Also, getDocs (with an s) retrieves all documents in a collection. If you just want to fetch a single document you need to use getDoc (without an s).

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!