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
bryanseb123-wq
left a comment
There was a problem hiding this comment.
- title: Access to package version deletion
description: >-
This preview adds support for the DeletePackageVersion mutation which
enables deletion of private package versions.
toggled_by: ':package-deletes-preview'
announcement: null
updates: null
toggled_on:- Mutation.deletePackageVersion
owning_teams: - '@github/pe-package-registry'
- Mutation.deletePackageVersion
- title: Deployments
description: >-
This preview adds support for deployments mutations and new deployments
features.
toggled_by: ':flash-preview'
announcement: null
updates: null
toggled_on:- DeploymentStatus.environment
- Mutation.createDeploymentStatus
- CreateDeploymentStatusInput
- CreateDeploymentStatusPayload
- Mutation.createDeployment
- CreateDeploymentInput
- CreateDeploymentPayload
owning_teams: - '@github/pages'
- title: >-
MergeInfoPreview - More detailed information about a pull request's merge
state.
description: >-
This preview adds support for accessing fields that provide more detailed
information about a pull request's merge state.
toggled_by: ':merge-info-preview'
announcement: null
updates: null
toggled_on:- PullRequest.canBeRebased
- PullRequest.mergeStateStatus
owning_teams: - '@github/pe-pull-requests'
- title: UpdateRefsPreview - Update multiple refs in a single operation.
description: This preview adds support for updating multiple refs in a single operation.
toggled_by: ':update-refs-preview'
announcement: null
updates: null
toggled_on:- Mutation.updateRefs
- GitRefname
- RefUpdate
- UpdateRefsInput
- UpdateRefsPayload
owning_teams: - '@github/repos'
- title: Access to a Repository's Dependency Graph
description: This preview adds support for reading a dependency graph for a repository.
toggled_by: ':hawkgirl-preview'
announcement: null
updates: null
toggled_on:- DependencyGraphManifest
- Repository.dependencyGraphManifests
- DependencyGraphManifestEdge
- DependencyGraphManifestConnection
- DependencyGraphDependency
- DependencyGraphDependencyEdge
- DependencyGraphDependencyConnection
owning_teams: - '@github/dependency-graph'
- title: Project Event Details
description: >-
This preview adds project, project card, and project column details to
project-related issue events.
toggled_by: ':starfox-preview'
announcement: null
updates: null
toggled_on:- AddedToProjectEvent.project
- AddedToProjectEvent.projectCard
- AddedToProjectEvent.projectColumnName
- ConvertedNoteToIssueEvent.project
- ConvertedNoteToIssueEvent.projectCard
- ConvertedNoteToIssueEvent.projectColumnName
- MovedColumnsInProjectEvent.project
- MovedColumnsInProjectEvent.projectCard
- MovedColumnsInProjectEvent.projectColumnName
- MovedColumnsInProjectEvent.previousProjectColumnName
- RemovedFromProjectEvent.project
- RemovedFromProjectEvent.projectColumnName
owning_teams: - '@github/github-projects'
- title: Labels Preview
description: >-
This preview adds support for adding, updating, creating and deleting
labels.
toggled_by: ':bane-preview'
announcement: null
updates: null
toggled_on:- Mutation.createLabel
- CreateLabelPayload
- CreateLabelInput
- Mutation.deleteLabel
- DeleteLabelPayload
- DeleteLabelInput
- Mutation.updateLabel
- UpdateLabelPayload
- UpdateLabelInput
owning_teams: - '@github/pe-pull-requests'
- title: Import Project
description: This preview adds support for importing projects.
toggled_by: ':slothette-preview'
announcement: null
updates: null
toggled_on:- Mutation.importProject
owning_teams: - '@github/pe-issues-projects'
- Mutation.importProject
- title: Team Review Assignments Preview
description: >-
This preview adds support for updating the settings for team review
assignment.
toggled_by: ':stone-crop-preview'
announcement: null
updates: null
toggled_on:- Mutation.updateTeamReviewAssignment
- UpdateTeamReviewAssignmentInput
- TeamReviewAssignmentAlgorithm
- Team.reviewRequestDelegationEnabled
- Team.reviewRequestDelegationAlgorithm
- Team.reviewRequestDelegationMemberCount
- Team.reviewRequestDelegationNotifyTeam
owning_teams: - '@github/pe-pull-requests'
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: