-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
star.<created|deleted>
handler failing
#2
Comments
This is a really good idea. Thank you so much! My PC is currently low, and I may have to use my mobile phone to try and trigger the bot. So, my response may come in a bit late, and seem a little far-fetched I'll be back shortly with the feedback |
When I tried using the bot, by starring the repo it is installed on, since I don't have any way to verify which calls are being sent. I have this error AggregateError:
HttpError: Not found. May be due to lack of authentication. Reason: Handling a "star.created" event: an "installation" key is missing. The installation ID cannot be determined
at /var/task/node_modules/@octokit/request/dist-node/index.js:86:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Job.doExecute (/var/task/node_modules/bottleneck/light.js:405:18) ...and here's what is in the headers. I think the github signature headers too are missing, and I still haven't figured out why it like this. To fix this, sometime ago... I even tried installing and uninstalling the bot, nothing changed. Cache-Control: public, max-age=0, must-revalidate
Content-Length: 441
Date: Sun, 26 Feb 2023 21:09:19 GMT
Server: Vercel
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Vercel-Cache: MISS
X-Vercel-Id: iad1::iad1::vzdv8-1677445757568-185e06ffa020 |
I suggest you modify your code to get some extra logs after each of the tasks performed by your event handler to see when is this You can also debug your Probot app on your local machine, which makes it easier to get the details and debuggers to see how your code behaves. To test your app, you can simulate some events. |
Okay, great! I'll try doing this, and take a look at the simulation of events. But, I think the point where I run into an issue with testing it locally, is that when I run |
Did you try following the steps in Probot's documentation? https://probot.github.io/docs/development/#running-the-app-locally |
Sorry for cycling back late @oscard0m. Yes, I've followed the steps in the robot documentation, but I kept getting a server error. That's not the case though, as the problem is with the stars.created and .deleted webhook events. Anytime I perform these actions, I keep getting the authentication error. I even went on to install the bot on a public repo, perhaps the reason why it wasn't working before as because it is installed on a private repository — still the same thing. I even tried generating a new private key and changed my webhook secret. Nada. |
Did you validate which of the calls to GitHub API is giving problems?: I think it would be interesting to check that. Also, can you share which permissions your GitHub App have? https://docs.github.com/en/apps/maintaining-github-apps/editing-a-github-apps-permissions |
This means this handler is the one giving problems but inside this handler, which Request to GitHub API via Octokit is giving problems? Can you check that?
|
Oh! okay lemme do that now |
Okay, I just realized that i can't test locally without running into some issues. But, when I push, and I check the webhook events that are fired, these events, below are where errors are coming from, and I can't exactly pin point with exact method of octokit is causing it. Line 36 in ef6a92f
|
Maybe you can try adding some to extra logs as I pointed in a past comment? You can also try small steps:
|
Okay... I'll do that and come back with feedback. Might take a while — perhaps in the afternoon. 🙏🙏 |
Ah! Great! These steps you added sounds great. I'll go through them. |
Okay, so I tried the option you mentioned — by commenting all the octokit instances in the handler function. The authentication error below persisted, nonetheless 👇🏼 AggregateError:
HttpError: Not found. May be due to lack of authentication. Reason: Handling a "star.created" event: an "installation" key is missing. The installation ID cannot be determined
at /var/task/node_modules/@octokit/request/dist-node/index.js:86:21
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Job.doExecute (/var/task/node_modules/bottleneck/light.js:405:18) One thing I noticed; whenever I star the repo, a When I did, I got the same auth error, but in this case, it was peculiar to the watch event. The funny thing now is that the So now, I'm thinking the issue is from my probot installation — because, by default, I think probot handles the issue of authentication out-of-the-box for us, yeah? I'll try setting up another probot app locally, if the is still persists, I'll reach out again. |
With this said, I suspect the auth token you are using is not correct. Make sure you configured it correctly. More details here: https://probot.github.io/docs/configuration/ |
Oh oh! great! I'll have a look now. |
So they are exactly the same as in your GitHub App settings? |
Yes, actually. |
Here you can find a version working: https://github.com/oscard0m/stargazer-test
I'm using the code but I had to use some adjustments. Using local development was quite easy to spot the issues. I'm happy to schedule a session to pair-program on this and help you setup the local environment correctly and show you how to debug, etc. Feel free to ask any question about my solutions |
Wohooo!! Thank you so much. I'll have a look now. |
When will you be free for a session and what exactly was the error 😭 |
I am opening this issue where we can comment on your usecase. I think we are adding noise to this already existing discussion in Probot's repo: probot/probot#1795
Your handler is doing 3 or 4 calls (depending on the conditionals) to GitHub's API:
context.octokit.issues.listForRepo
context.octokit.issues.create
context.octokit.users.getByUsername
context.octokit.issues.createComment
Can you validate which requests to the API are working and which one/s are giving you a 401? I think it's a good start to try to figure out this first of all.
The text was updated successfully, but these errors were encountered: