grassrootsgrocery / admin-portal

GNU Affero General Public License v3.0
11 stars 6 forks source link

Fix `mapper` error in messaging #117

Closed 6mp closed 1 year ago

6mp commented 1 year ago

Description of this change

Attempting to fix as discussed on monday.com. Fix involves checking if array is empty before mapping.

[2023-08-12T12:54:51.756Z] ERROR: [200]: Cannot read properties of undefined (reading 'mapper') TypeError: Cannot read properties of undefined (reading 'mapper')
at /app/dist/routes/messaging.js:230:83
at step (/app/dist/routes/messaging.js:33:23)
at Object.next (/app/dist/routes/messaging.js:14:53)
at fulfilled (/app/dist/routes/messaging.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
railway-app[bot] commented 1 year ago

This PR is being deployed to Railway 🚅

admin-portal: ◻️ REMOVED

mattsahn commented 1 year ago

Associated issue in Monday is here: https://grassroots-grocery.monday.com/boards/2826542086/pulses/4976238683/posts/2342246196

Just need to figure a way to test without triggering the actual texts.

mattsahn commented 1 year ago

This is a good fix as discussed in Monday, but is not the actual issue that Dan had, and isn't the cause of the unrelated errors we're seeing in the logs. But, we should add this one so that it handles the scenario of no records in the response. I'll create new issue for the other one.