probot: robot.on() throws on installation.deleted
robot.on() fetches a new token using the payload’s installation id. However, if that installation doesn’t exist (as is the case if one was just deleted), robot.on() will throw and the event handler won’t run.
This is of course an edge-case; how could GitHub send the installation id of an installation that doesn’t exist? Well, if it was just deleted of course!
Here’s what the error message looks like:
err: {
"code": 404,
"status": "Not Found",
"message": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/apps/#create-a-new-installation-token\"}"
}
--
event: {
"id": "4691d930-ee69-11e7-8126-16c94070ecf0",
"event": "installation.deleted",
"installation": 123
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 15 (8 by maintainers)
It’ll be something like this.
@aryannarora some pseudo code to illustrate what I meant:
Within
robot.auth, whichrobot.onuses under the hood, the part where it authenticates thecontext.githubclient as the installation throws an error.