sun-asterisk-research / shope-shop

Simple shop is used for Sun* Atlas's training purposes
https://shope.sun-asterisk.vn
0 stars 0 forks source link

Error: `users.cart.items.product` is undefined #1

Open kimyvgy opened 2 weeks ago

kimyvgy commented 2 weeks ago
INFO[0041] add product to cart 500 {"statusCode":500,"error":"Internal Server Error","message":"undefined is not an object (evaluating 'p.product.toString')"}  source=console
INFO[0041] get checkout 500 {"statusCode":500,"error":"Internal Server Error","message":"undefined is not an object (evaluating 'p.product.price')"}  source=console
INFO[0041] checkout 500 {"statusCode":500,"error":"Internal Server Error","message":"undefined is not an object (evaluating 'p.product.price')"}  source=console

Actual database record:

{
  "_id": {
    "$oid": "664c0af09bad22647fc45072"
  },
  "username": "customer1",
  "password": "$argon2id$v=19$m=65536,t=2,p=1$xe7Ry9jiR7wzxP9DiD4htfcwxBfgr1ETIiW9i22depY$10L+AWJL8daLkw1Nwa+sHu3oe0ppk0SrIuJGTLUcDRM",
  "cart": {
    "items": [
      {
        "quantity": 1
      }
    ]
  },
  "createdAt": {
    "$date": "2024-05-21T02:46:08.066Z"
  },
  "updatedAt": {
    "$date": "2024-06-18T04:01:24.576Z"
  },
  "__v": 114
}
kimyvgy commented 2 weeks ago

Workaround: run aggregation pipeline to clear cart:

[
  {
    "cart.items": []
  }
]