Probot: Add request information in case of a request/server error

Created on 14 May 2020  路  5Comments  路  Source: probot/probot

I'm trying to get milestone metadata when a probot app is added to a repo.

  app.on("installation_repositories.added", async (context) => {
    const repos = context.payload.repositories_added;

    for await (const repo of repos) {
      const repoId = repo.id;
      const senderId = context.payload.sender.id;

      const milestones = await context.github.issues.listMilestonesForRepo({
        owner: senderId,
        repo: repoId,
      });

      /// do something with milestones
    }
  });

However, I get this error

12:58:13.693Z ERROR event: Not Found (id=xxxxxxx)
  HttpError: Not Found
      at /Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/@octokit/request/dist-node/index.js:66:23
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Job.doExecute (/Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/bottleneck/light.js:405:18)
  --
  event: {
    "event": "installation_repositories.added",
    "id": "xxxxxx",
    "installation": xxxxx
  }
12:58:13.694Z ERROR probot: Not Found
  HttpError: Not Found
      at /Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/@octokit/request/dist-node/index.js:66:23
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Job.doExecute (/Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/bottleneck/light.js:405:18)
12:58:13.694Z  INFO http: POST / 500 - 245.68 ms (id=xxxxxxx)
12:58:13.695Z ERROR probot: Internal Server Error
  Error: Internal Server Error
      at Request.callback (/Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/superagent/lib/node/index.js:706:15)
      at IncomingMessage.<anonymous> (/Users/lukepighetti/development/misc/burncharts/probot-app/node_modules/superagent/lib/node/index.js:916:18)
      at IncomingMessage.emit (events.js:322:22)
      at IncomingMessage.EventEmitter.emit (domain.js:482:12)
      at endReadableNT (_stream_readable.js:1187:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)

I'm not sure what "Not found" means or how to proceed.

pinned

All 5 comments

you don't set repo and owner to IDs, you set it to their respective names

This issue is not about the correct use of the API, but the unhelpful error messages.

I agree, the error should include information about the request that has been sent. That is something that @octokit/rest does by default, I'm not sure why probot does not

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Probot sets request information now v10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jake-Gillberg picture Jake-Gillberg  路  3Comments

zeke picture zeke  路  4Comments

ezyang picture ezyang  路  3Comments

zeke picture zeke  路  6Comments

zeke picture zeke  路  4Comments