When starting this page, with items in the cart (without is the same), I’ll get this error:
Uncaught (in promise) TypeError: Cannot read property 'id' of undefined
at Object.exports.cartMapper (@wix/wixstores-platform-common/src/carts/cart.mapper.ts:213:18)
at @wix/wix-stores-backend/src/carts.ts:198:14
at bound (domain.js:396:14)
at runBound (domain.js:409:12)
at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:510:31)
at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:584:18)
at Async._drainQueue (node_modules/bluebird/js/main/async.js:128:12)
at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:121:23)
What I am doing wrong?
I already tried working with ‘new Promise’ in backend side, instead of using async/await, with same result.
At the end it should be the same.
And yes, on client side I am getting exact same error.
And I still don’t understand why I am getting this.
It’s just a simple request without any complexity around.
BTW: The reason is server side, it’s just the server “rejecting” the promise with this error.
I also am having the problem with getCurrentCart not working on live site. It works from the website editor preview but not in live. Is there a permission issue that needs to be set to allow this function to work? My live site is a logged in member of the site.
export function getuserscart() { let currentcart = wixStores.getCurrentCart(); return currentcart;
}
on the backend I am getting this in the console log
11/12/2019, 12:29:44.835 PM[“Cannot read property ‘id’ of undefined”]ERROR
Did anyone ever get to the bottom of this? I’m having the “Cannot read property ‘id’ of undefined” from client side code … it was working perfectly well previously and has now randomly decided not to play nicely.
Its a bit poor that these threads don’t result in either a resolution or marked as closed as a non issue with some helpful commentary.
As a relative newbie to this forum it looks like a really unhelpful environment when I see so many threads (way more than lead to something helpful) where I can see people have been struggling and seemingly left to struggle with no replies to their posts … they may have been dealt with somewhere else but the perception is that they have just been ignored.
If these queries were attended to elsewhere it would be better to close off these threads so it doesn’t just look like a place where the only noise is your own echo.
Just a bit of commentary as a newbie to Wix and its community forums.
@andybrennan1 Great feedback! We agree and are working to resolve this soon. In the meantime, it’s helpful to mark “Best Answer” when possible, or to write SOLVED in the title of posts once an issue is closed. Thanks, Andy!
Hola,
La solución cuando invocamos el método getCurrentCart() de wix-stores-backend y da el sigiuente error:
Cart with person identity 46ef0d8c-23d5-46f5-87dd-5142a87f7a86 not found
//Backend → archivo producto.jsw import wixStoresBackend from ‘wix-stores-backend’
//Cart Page import { getCurrentCart } from ‘backend/productos.jsw’
$w . onReady ( function () {
getCurrentCart ()
. then ( result => { arguments
console . log ( result , ‘current cart’ )
})
});
El problema es que en el ambiente de ‘Vista Previa’ no funciona el código su totalidad, debes publicar y ver el sitio, en ese ‘ambiente’ verás los cambios (el console.log())