probot: Installation ID missing from `issue_comment.created` event
Bug Report
Current Behavior
When handling an issue_comment.created event, I get 401 response due to the lack of installation key. However, when handling an issues.created event, everything works as expected.
/**
* This is the main entrypoint to your Probot app
* @param {import('probot').Probot} app
*/
module.exports = (app) => {
// Your code here
app.log.info("Yay, the app was loaded!");
app.on("issues.opened", async (context) => {
const issueComment = context.issue({
body: "Thanks for opening this issue!",
});
return context.octokit.issues.createComment(issueComment);
});
app.on("issue_comment.created", async (context) => {
const issueComment = context.issue({
body: "Thanks for commenting on this issue!",
});
return context.octokit.issues.createComment(issueComment);
});
// For more information on building apps:
// https://probot.github.io/docs/
// To get your app running against GitHub, see:
// https://probot.github.io/docs/development/
};
Expected behavior/code I’d expect that all events would have installation IDs. Please correct me if I’m wrong. Environment
- Probot version(s): Since there’s a problem with the programmatic API after npm v8, I used the following command to create my bot:
npx create-probot-app@v5.0.9 my-example-app - Node/npm version: Node 16.10/npm 7.24
- OS: macOS Ventura 13.2
Possible Solution
Additional context/Screenshots Error log:
HttpError: Unauthorized. "POST /repos/{owner}/{repo}/issues/{issue_number}/comments" failed most likely due to lack of authentication. Reason: Handling a "issue_comment.created" event: an "installation" key is missing. The installation ID cannot be determined
at /Users/i542072/my-example-app/node_modules/@octokit/request/dist-node/index.js:86:21
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Job.doExecute (/Users/i542072/my-example-app/node_modules/bottleneck/light.js:405:18)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (5 by maintainers)
Commits related to this issue
- feat(issue-created): test probot app https://github.com/probot/probot/issues/1795#issue-1569855955 — committed to oscard0m/stargazer-test by oscard0m a year ago
Closing as this isn’t a Probot issue. This seems more like a problem on GitHub’s side
Awesome! I’ll do that now.