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

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

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 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!