roadie-backstage-plugins: Github Insights Plugin Breaks When Environments Are Not Found

Expected Behavior

When environments are not found, show the working insight cards. Handle the failure more gracefully, show an error message in the card or don’t show the environments card.

Current Behavior

Screen Shot 2023-01-11 at 12 14 43 PM

Steps to Reproduce

When hitting /environments our enterprise github instance returns { "message": "Not Found", "documentation_url": "https://docs.github.com/enterprise/3.5/rest/reference/repos#get-all-environments" }. We do not use environments and I am not sure if it is offered for the enterprise solution.

Possible Solution

Have the insights plugin be configurable so that you can choose not to show the environments card. Another option, handle the error differently. https://github.com/RoadieHQ/roadie-backstage-plugins/blob/4afa4fbde40102a06c13ad0d4a3f4a210521a6d3/plugins/frontend/backstage-plugin-github-insights/src/components/Widgets/EnvironmentsCard/EnvironmentsCard.tsx#L58 If the environments are not found show an error message only in the environments card not in the larger insights card.

Context

Currently the plugin doesn’t work for us.

Your Environment

  • @backstage/plugin-catalog-react version: 1.2.3
  • @backstage/integration version: 1.4.1
  • roadiehq/backstage-plugin-github-insights@2.3.2

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 20 (7 by maintainers)

Most upvoted comments

Update on the above - In addition to what jef mentioned, the github app must also have actions:read permission in order to combat EnvironmentsCard issue. So environment:read and actions:read for the backstage github app did it for me.

NVM, I see it’s only for Github Apps not Oauth

I figured out the issue. If the GitHub app doesn’t have Read permissions on Environments, then it will fail to pull that information.

Sorry in advanced for commenting here too 😅 Could be worthwhile to add that note to the docs!

Thank you! 😌

Absolutely!

@sarahpmedeiros Thanks for reporting this, I agree it should handle it a lot more gracefully! Would you be up for fixing it?

@jef Could you please open a separate issue if you do use and you should see the environments and we can tackle it in that one.