Skip to content

Handle possible Github API rejection at prepareItemStep #2

Description

@LearningProcesss

GithubSyncService's pipeline must catch possible rejections when fetching repo's commits and languages during prepareItemStep.

RequestError [HttpError]: Repository access blocked
    at /workspaces/better-gh-watched/node_modules/@octokit/request/dist-node/index.js:86:21
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Job.doExecute (/workspaces/better-gh-watched/node_modules/bottleneck/light.js:405:18) {
  status: 451,
  response: {
    url: 'https://api.github.com/repos/arifnoumankhan/books/commits?page=1&per_page=1',
    status: 451,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      connection: 'close',
      'content-length': '187',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Fri, 07 Jan 2022 17:43:04 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-accepted-oauth-scopes': '',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'D7D5:1112:4873A2:4AF060:61D87BA8',
      'x-oauth-client-id': '7960cb405d3d74742e13',
      'x-oauth-scopes': 'user:email',
      'x-ratelimit-limit': '5000',
      'x-ratelimit-remaining': '3730',
      'x-ratelimit-reset': '1641579822',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '1270',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Repository access blocked',
      block: {
        reason: 'dmca',
        created_at: '2020-07-23T20:32:55Z',
        html_url: 'https://github.com/github/dmca/blob/master/2020/07/2020-07-22-Oreilly.md'
      }
    }
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/arifnoumankhan/books/commits?page=1&per_page=1',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/1.7.1 octokit-core.js/3.5.1 Node.js/16.13.0 (linux; x64)',
      authorization: 'token [REDACTED]'
    },
    request: {
      hook: [Function: bound bound register],
      retryCount: 3,
      retries: 3,
      retryAfter: 16
    }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions