backstage: HttpError: Not Found when publishing GitHub repo with scaffolder

Expected Behavior

No error

Current Behavior

GitHub API returns not found sometimes as it’s eventually consistent

Code here is bombing out: https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/github.ts#L169-L186

Possible Solution

Thinking of either trying to retrieve from GitHub API or just adding in some retries

Steps to Reproduce

  1. scaffold with a template that adds github teams
  2. attempt a few times, I’ve had it happen to me 2 out of ~15 tries

Context

Other blocks in the GitHub publisher have try .. catch .. log but that’s a terrible pattern as the user will likely never see it. This needs proper hardening.

Discussed with @benjdlambert at https://discord.com/channels/687207715902193673/913812564750766150/913819958193045536

Your Environment

  • NodeJS Version (v14):
  • Operating System and Version (e.g. Ubuntu 14.04):
  • Browser Information:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (19 by maintainers)

Most upvoted comments

I guess that is covered by #9208? 🙏

Done!

It looks like we’re on the legacy octokit package: https://github.com/octokit/octokit.js/discussions/620#discussioncomment-917159

The new one supports retries:

The octokit package also implements best practices for paginating REST API requests, request throttling, and request retries.

I’ll look at what it would take to migrate across 😄