medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
468 stars 217 forks source link

Feedback doc: TypeError: Cannot read properties of undefined (reading '_id') #9441

Open kennsippell opened 1 month ago

kennsippell commented 1 month ago

Describe the bug

Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading '_id')
TypeError: Cannot read properties of undefined (reading '_id')
    at https://nairobi-echis.health.go.ke/main.js:1:1605730
    at Generator.next (<anonymous>)
    at E (https://nairobi-echis.health.go.ke/main.js:1:1285)
    at h (https://nairobi-echis.health.go.ke/main.js:1:1487)
    at https://nairobi-echis.health.go.ke/main.js:1:1546
    at new r (https://nairobi-echis.health.go.ke/polyfills.js:1:22884)
    at https://nairobi-echis.health.go.ke/main.js:1:1428
    at n.updateFastActions (https://nairobi-echis.health.go.ke/main.js:1:1605805)
    at Object.next (https://nairobi-echis.health.go.ke/main.js:1:1603550)
    at Yr.next (https://nairobi-echis.health.go.ke/main.js:1:8993)
    at ve (https://nairobi-echis.health.go.ke/polyfills.js:1:20329)
    at https://nairobi-echis.health.go.ke/polyfills.js:1:19403
    at https://nairobi-echis.health.go.ke/polyfills.js:1:19511
    at E (https://nairobi-echis.health.go.ke/main.js:1:1320)
    at h (https://nairobi-echis.health.go.ke/main.js:1:1487)
    at https://nairobi-echis.health.go.ke/main.js:1:1546
    at new r (https://nairobi-echis.health.go.ke/polyfills.js:1:22884)
    at https://nairobi-echis.health.go.ke/main.js:1:1428
    at n.updateFastActions (https://nairobi-echis.health.go.ke/main.js:1:1605805)
    at Object.next (https://nairobi-echis.health.go.ke/main.js:1:1603550)

To Reproduce Production data

Expected behavior Don't crash

Logs

Environment

Additional context This is in webapp/src/ts/modules/reports/reports-content.component.ts

    this.fastActionList = await this.fastActionButtonService.getReportRightSideActions({
      reportContentType: selectedReportDoc.content_type,
      communicationContext: {
        sendTo: await this.getReportContact(selectedReportDoc.contact._id),
        callbackOpenSendMessage: (sendTo) => this.modalService.show(SendMessageComponent, { data: { to: sendTo } }),
      },
    });
kennsippell commented 1 month ago

It's possible from user reports that they experience this "Error loading form" when this triggers. image

Another stack

"Uncaught (in promise): TypeError: Cannot read properties of undefined (reading '_id')
TypeError: Cannot read properties of undefined (reading '_id')
    at https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:1101774
    at Generator.next (<anonymous>)
    at c$ (https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:506804)
    at h (https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:507007)
    at https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:507068
    at d (https://nairobi-echis.health.go.ke/polyfills.js?_sw-precache=edc39369e9333bcb01fe3d162d9ada63:1:23310)
    at https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:506948
    at r.updateFastActions (https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:1101882)
    at Object.next (https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:1099592)
    at G.next (https://nairobi-echis.health.go.ke/main.js?_sw-precache=90acff8d536409fe701a30df7bdac6c7:1:3451)"
kennsippell commented 4 weeks ago

Would be great to know of workarounds for this if there is one... A lot of complaints in our eCHIS support channels for this "error loading forms". Blocking some CHPs from working.

latin-panda commented 4 weeks ago

@kennsippell can you please attach the task form and the report form triggering these errors? Or a snapshot of those forms if there are some privacy concerns

kennsippell commented 3 weeks ago

Oops. Found https://github.com/medic/cht-core/issues/9557 which is a better explanation for the error loading form. I dunno if the crash in this issue has any user-facing symptoms. My mistake!