Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

447
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda