Repository navigation
Fix JavaScript SyntaxError: add missing async in GitHub App webhook handler example - #47108
ShakilUrRehman21 wants to merge 1 commit into
Conversation
How to review these changes 👓Thank you for your contribution. To review these changes, choose one of the following options: A Hubber will need to deploy your changes internally to review. Table of review linksNote: Please update the URL for your staging server or codespace. The table shows the files in the
Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server 🤖 This comment is automatically generated. |
There was a problem hiding this comment.
🟢 Approval recommended
The change addresses the identified JavaScript issue by making the webhook callback asynchronous, with no remaining review issues indicated.
No open issues 🎉
What changed in this PR
This PR fixes the GitHub App webhook handler example by making its callback asynchronous so the existing await expression is valid JavaScript.
Changes:
- Added
asyncto theissues.openedwebhook handler callback. - Preserved the existing authentication, API request, and documentation flow.
| File | Description |
|---|---|
| content/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md | Updates the webhook handler example to use an asynchronous callback for its existing API request. |
Review effort: Lite
Why:
In
content/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md, the code sample demonstrating how to handle webhook events usingapp.webhooks.on("issues.opened", ...)usesawait octokit.request(...)inside the callback arrow function.However, the callback signature was not declared as
async. When copying and running this code in Node.js, it immediately throws:This PR adds
asyncto the callback parameters (async ({ octokit, payload }) => {), ensuring the tutorial example is syntactically valid and executable.What's being changed:
asyncto theissues.openedwebhook handler arrow function callback incontent/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation.md.Check off the following: