Blank '500 Internal Server Error' from API

Hey all,

I’m getting a rather annoying blank ‘500 Internal Server Error’ response from an API call, can I have no clue where to even begin trying to figure out why.

Repro steps:

  1. Fork https://github.com/cdnjs/cdnjs to your own account
  2. Create a personal access token on your account with full access (I think just repo should work, but not sure)
  3. Clone https://github.com/MattIPv4/cdnjs-add-cli locally
  4. Run npm i within the cloned repo
  5. Copy config.example.js to config.js
  6. Update the config.js file with required info
  7. githubToken should be the personal access token you created
  8. targetRepoOwner should be your account name (where you forked cdnjs/cdnjs)
  9. targetRepoName should be cdnjs (unless you renamed the forked repo)
  10. Run node index.js jquery-loading
  11. Enter jquery-easy-loading for the first prompt (NPM package name)
  12. Press enter with no input for the next two prompts (path explore & glob explore)
  13. Enter dist for the next prompt (base path)
  14. Enter *.js for the next prompt (glob)
  15. Press enter with no input for the next two prompts (glob & base path)
  16. Enter jquery.loading.min.js for the final prompt (default file)
  17. Observe that it attempts to and fails to create a PR for this new library on your fork

The error:

RequestError [HttpError]
    at [REDACTED]/cdnjs-add-cli/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async createPullRequest ([REDACTED]/cdnjs-add-cli/node_modules/octokit-create-pull-request/lib/create-pull-request.js:85:14)
    at async createPR ([REDACTED]/cdnjs-add-cli/index.js:120:12)
    at async main ([REDACTED]/cdnjs-add-cli/index.js:253:20) {
  name: 'HttpError',
  status: 500,
  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-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    connection: 'close',
    'content-length': '0',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Sat, 28 Mar 2020 13:17:11 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    status: '500 Internal Server Error',
    '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': 'F4B5:2D378:259D2F9:2C04191:5E7F4E4E',
    'x-oauth-scopes': 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, read:packages, repo, user, workflow, write:discussion, write:packages',
    'x-ratelimit-limit': '5000',
    'x-ratelimit-remaining': '4767',
    'x-ratelimit-reset': '1585401878',
    'x-xss-protection': '1; mode=block'
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/cdnjs-test/cdnjs/git/trees',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/17.1.4 octokit-core.js/2.4.3 Node.js/12.10.0 (macOS Mojave; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"base_tree":"6b05c813a41847661c5fb06647dfd34030a609a4","tree":[{"path":"ajax/libs/jquery-loading/package.json","mode":"100644","content":"{\\n \\"name\\": \\"jquery-loading\\",\\n \\"description\\": \\"Easily add and manipulate loading states of any element on the page\\",\\n \\"keywords\\": [\\n \\"jquery\\",\\n \\"jquery-plugin\\",\\n \\"ecosystem:jquery\\",\\n \\"overlay\\",\\n \\"loading\\",\\n \\"loader\\",\\n \\"ajax\\"\\n],\\n \\"author\\": {\\n \\"name\\": \\"Carlos Bonetti\\",\\n \\"email\\": \\"carlosbonetti.mail@gmail.com\\"\\n },\\n \\"license\\": \\"MIT\\",\\n \\"homepage\\": \\"http://carlosbonetti.github.io/jquery-loading/\\",\\n \\"repository\\": {\\n \\"type\\": \\"git\\",\\n \\"url\\": \\"git+ssh://git@github.com/CarlosBonetti/jquery-loading.git\\"\\n },\\n \\"npmName\\": \\"jquery-easy-loading\\",\\n \\"npmFileMap\\": [\\n {\\n \\"basePath\\": \\"dist\\",\\n \\"files\\": [\\n \\"*.js\\"\\n]\\n }\\n ],\\n \\"filename\\": \\"jquery.loading.min.js\\"\\n}\\n"}]}',
    request: { hook: [Function: bound bound register] }
  }
}

Any help would be greatly appreciated in resolving this.