K-Phoen / backstage-plugin-opsgenie

OpsGenie plugin for Backstage
MIT License
35 stars 39 forks source link

Cannot read properties of undefined (reading 'name') after updating backstage #118

Open prasoon-pxc opened 1 year ago

prasoon-pxc commented 1 year ago

I have updated the backstage from 1.7.1 to 1.10.1 , after updating the backstage , opsgenie plugin stop working , plugin with components page is still working i.e I am able to show alert or "who-is-on-call" on specific component page but standalone page for this plugin is giving error.

PF image

I have checked and found that opsgenie plugin gets updated from 0.6.1 to 0.6.4

yarn run v1.22.19
$ /home/il58d0/smb/backstage-conf-repo/backstage-conf-repo-original/node_modules/.bin/backstage-cli info
OS:   Linux 5.14.0-1055-oem - linux/x64
node: v16.14.0
yarn: 1.22.19
cli:  0.22.1 (installed)
backstage:  1.10.1

Dependencies:
  @backstage/app-defaults                          1.1.0
  @backstage/backend-app-api                       0.3.1
  @backstage/backend-common                        0.17.0, 0.18.1
  @backstage/backend-plugin-api                    0.3.1
  @backstage/backend-tasks                         0.4.2
  @backstage/backend-test-utils                    0.1.33
  @backstage/catalog-client                        1.3.0
  @backstage/catalog-model                         1.1.5
  @backstage/cli-common                            0.1.11
  @backstage/cli                                   0.22.1
  @backstage/config-loader                         1.1.8
  @backstage/config                                1.0.6
  @backstage/core-app-api                          1.4.0
  @backstage/core-components                       0.12.3
  @backstage/core-plugin-api                       1.3.0
  @backstage/errors                                1.1.4
  @backstage/integration-aws-node                  0.1.1
  @backstage/integration-react                     1.1.9
  @backstage/integration                           1.4.2
  @backstage/plugin-api-docs                       0.8.14
  @backstage/plugin-app-backend                    0.3.41
  @backstage/plugin-auth-backend                   0.17.4
  @backstage/plugin-auth-node                      0.2.10
  @backstage/plugin-bazaar-backend                 0.2.4
  @backstage/plugin-bazaar                         0.2.3
  @backstage/plugin-catalog-backend-module-github  0.2.4
  @backstage/plugin-catalog-backend                1.7.1
  @backstage/plugin-catalog-common                 1.0.10
  @backstage/plugin-catalog-graph                  0.2.26
  @backstage/plugin-catalog-import                 0.9.4
  @backstage/plugin-catalog-node                   1.3.2
  @backstage/plugin-catalog-react                  1.2.4
  @backstage/plugin-catalog                        1.7.2
  @backstage/plugin-events-node                    0.2.2
  @backstage/plugin-github-actions                 0.5.14
  @backstage/plugin-home                           0.4.30
  @backstage/plugin-org                            0.6.4
  @backstage/plugin-permission-common              0.7.3
  @backstage/plugin-permission-node                0.7.4
  @backstage/plugin-permission-react               0.4.9
  @backstage/plugin-playlist-backend               0.2.4
  @backstage/plugin-playlist-common                0.1.4
  @backstage/plugin-playlist                       0.1.5
  @backstage/plugin-proxy-backend                  0.2.35
  @backstage/plugin-scaffolder-backend             1.10.1
  @backstage/plugin-scaffolder-common              1.2.4
  @backstage/plugin-scaffolder-react               1.0.1
  @backstage/plugin-scaffolder                     1.10.1
  @backstage/plugin-search-backend-module-pg       0.5.2
  @backstage/plugin-search-backend-node            1.1.2
  @backstage/plugin-search-backend                 1.2.2
  @backstage/plugin-search-common                  1.2.1
  @backstage/plugin-search-react                   1.4.0
  @backstage/plugin-search                         1.0.7
  @backstage/plugin-shortcuts                      0.3.6
  @backstage/plugin-sonarqube-backend              0.1.6
  @backstage/plugin-sonarqube-react                0.1.1
  @backstage/plugin-sonarqube                      0.6.2
  @backstage/plugin-stack-overflow                 0.1.10
  @backstage/plugin-tech-radar                     0.6.0
  @backstage/plugin-techdocs-backend               1.5.2
  @backstage/plugin-techdocs-module-addons-contrib 1.0.9
  @backstage/plugin-techdocs-node                  1.4.5
  @backstage/plugin-techdocs-react                 1.1.2
  @backstage/plugin-techdocs                       1.4.3
  @backstage/plugin-todo-backend                   0.1.38
  @backstage/plugin-todo                           0.2.16
  @backstage/plugin-user-settings                  0.6.2
  @backstage/release-manifests                     0.0.8
  @backstage/test-utils                            1.2.4
  @backstage/theme                                 0.2.16
  @backstage/types                                 1.0.2
  @backstage/version-bridge                        1.0.3
Done in 0.80s.
mattbarlow-sg commented 1 year ago

I think the issue is related to this line: https://github.com/K-Phoen/backstage-plugin-opsgenie/blob/77dbedb81517560eba0a4dc008b0e3333807952b/src/api.ts#L184

The response from Opsgenie does not include an ownerTeam on every Schedule. So the response should probably be filtered like this: return response.data.filter(schedule => schedule.ownerTeam);

prasoon-pxc commented 1 year ago

thanks @mattbarlow-sg for your time , so this should be change in plugin side right? or I need to change it somewhere?

mattbarlow-sg commented 1 year ago

@prasoon-pxc I believe a change needs to happen in this plugin to filter out schedules that don't have an owner team, because of the reference here.

When I curl the Opsgenie schedules API I can see in the response that not all schedules have ownerTeam.

However, I just started looking at this plugin yesterday, so I might be missing something.

prasoon-pxc commented 1 year ago

@mattbarlow-sg thanks!!

prasoon-pxc commented 1 year ago

Hi, Do we have any chances to fix this?

deeparavirdc commented 1 year ago

Facing the same issue - is there a solution for the above or a plan to rollout the fix mentioned ?

deeparavirdc commented 1 year ago

Have a PR up for review - https://github.com/K-Phoen/backstage-plugin-opsgenie/pull/128. @K-Phoen could you please take a look ?