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

452
Visualizações
FirebaseError: Function setDoc() called with invalid data. Unsupported field value: undefined

OrderDetails Logged image

I want to save order details to my firestore db,Here my orderDetails:

const orderDetails=[{
                      id:"ID1",
                      name:"foo"
                     },
                     {
                     id:"ID2",
                     name:"foo-foo"
                     },
                     ]

Here is the code for adding this order Details to fire store:

 .then(({paymentIntent})=>{
  if(user){
    console.log(basket);
    const userRef=doc(db,'shopDB',user.uid);
    const userOrderRef=doc(userRef,'userOrderInfo',paymentIntent.id);
    setDoc(userOrderRef,{
      orders: basket,
      created :paymentIntent.created,
      amount :paymentIntent.amount
   },{merge:true})

Here all working if i set document without orderDetails,Other two values will added to fire store,but when i try to add orders to database it throws error

error>>>>>>>>>>>

 FirebaseError: Function setDoc() 
 called with invalid data. Unsupported
 field value: undefined

Can anyone help me with this?

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

0

looks like 1 of the 2 missing:

  1. orderDetails is undefined
  2. userOrderRef is undefined

try printing them both to make sure what's missing there

Edit:

now that I can see your console.log, your issue is with field alternative:undefined at element in index 1 according to your photo. remove this property before trying to save it on firestore

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