haven-life / persistor

Amorphic: ORM (PostgreSQL / MongoDB)
MIT License
0 stars 6 forks source link

Switch from forEach loop by switching to "for of..." #33

Closed kumar29 closed 5 years ago

kumar29 commented 5 years ago

We have seen the following stacktrace when attempt to fetch data

Cannot read property 'bucket' of undefined TypeError: Cannot read property 'bucket' of undefined\n at /opt/haven/app/node_modules/@havenlife/persistor/dist/lib/knex/query.js:420:47\n at /opt/haven/app/node_modules/underscore/underscore.js:188:11\n at Function..each..forEach (/opt/haven/app/node_modules/underscore/underscore.js:103:9)\n at Function..filter..select.

Investigating further this is bad promise handling in line 420 of query.js, with using the async pattern in a forEach loop. Fixing it to for of...resolved the problem