PagerDuty / backstage-plugin-backend

PagerDuty plugin for Backstage - Backend
https://pagerduty.github.io/backstage-plugin-docs/index.html
Apache License 2.0
3 stars 6 forks source link

PagerDutyPage Component Stays Loading Indefinitely Due to Backend Error #65

Closed MikeSmvl closed 1 month ago

MikeSmvl commented 1 month ago

Describe the bug The backend for the PagerDuty plugin in our Backstage setup is encountering an error when trying to fetch a PagerDuty service with an empty teams property. This results in the frontend PagerDutyPage component staying in a loading state indefinitely.

TypeError: Cannot read properties of undefined (reading 'name')
    at <anonymous> (/Users/.../Documents/git/workspace/dev-portal/node_modules/@pagerduty/backstage-plugin-backend/src/service/router.ts:159:74)
    at Array.forEach (<anonymous>)
    at buildEntityMappingsResponse (/Users/.../Documents/git/workspace/dev-portal/node_modules/@pagerduty/backstage-plugin-backend/src/service/router.ts:70:23)
    at <anonymous> (/Users/.../Documents/git/workspace/dev-portal/node_modules/@pagerduty/backstage-plugin-backend/src/service/router.ts:265:67)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

To Reproduce

  1. Install the PagerDuty plugin in a Backstage instance.
  2. Configure the plugin to fetch a PagerDuty service that has an empty teams array.
  3. Attempt to load the PagerDutyPage component.
  4. Observe the frontend page loading indefinitely.
  5. Check the backend console for the error.

Expected behavior The PagerDutyPage component should load successfully, even if the teams array of a service is empty.

Screenshots

image

Desktop (please complete the following information):

t1agob commented 1 month ago

Thanks for reporting this @MikeSmvl! Sometimes I forget that even though Teams are a recommended practice not everyone is using it. I'm reviewing your PR now and running a few tests and will get this merged ASAP.

t1agob commented 1 month ago

This issue has been fixed in #66 and merged into main. Please update your package to use version 0.7.1.